Problems with modifying data when I have a table called 'User'

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Guest

Problems with modifying data when I have a table called 'User'

Post by Guest » Wed 25 Jan 2006 05:23

Just recently switched to these components, and haven't had a problem except for today :(

One of our clients pointed out that they can no longer add a user. This seems to be because we have a table called 'user' which I assume is a special sql name as well, but the automatic generation of sql for the update, insert, and delete, doesn't seem to encode the table name.

MSSQL profiler shows that it has been sent through as User without doing [user] for example

exec sp_executesql N'UPDATE User
SET
Description = @P1, Notes = @P2
WHERE
ID = @P3', N'@P1 varchar(12),@P2 varchar(1),@P3 int', 'asdfasdf3333', NULL, 10

This creates an error....

Is there any properties I can set that will solve this?

We are basically doing a SELECT * FROM USER query for our grid, and then inserting/deleting/updating into the resulting TMSQuery dataset via the dx grid.

Thanks,

Toni

tonibrown
Posts: 7
Joined: Wed 25 Jan 2006 05:14

Post by tonibrown » Wed 25 Jan 2006 05:25

tonibrown is my login... sorry just learning how to use this newsgroup!

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Wed 25 Jan 2006 15:41

Please set Options.QuoteNames to True and try again.

tonibrown
Posts: 7
Joined: Wed 25 Jan 2006 05:14

Post by tonibrown » Wed 25 Jan 2006 22:23

Ikar wrote:Please set Options.QuoteNames to True and try again.
Hi Ikar,

That didn't seem to make much difference... the help also seemed to suggest that QuoteNames worked on fields.

A small seperate test was to put a MSQuery onto a form and set the option

object MSQuery1: TMSQuery
Options.QuoteNames = True
Left = 356
Top = 236
end


procedure TfrmMain.Button1Click(Sender: TObject);
begin

inherited;

MSQuery1.Connection := dmGlobal.DatabaseM.Connection;

MSQuery1.SQL.Text := 'SELECT * FROM [USER]';
MSQuery1.Open;

MSQuery1.First;
MSQuery1.Edit;
MSQuery1.FieldByName('Code').AsString := IntToStr(Random(1000));
MSQuery1.Post;

MSQuery1.Close;

end;


But in MSSQL profiler it does the following....

exec sp_executesql N'UPDATE USER
SET

Code: Select all

 = @P1
WHERE
  [ID] = @P2', N'@P1 varchar(3),@P2 int', '318', 1


which creates an exception in delphi

Any ideas?

Thanks,

Toni

Ikar
Posts: 1693
Joined: Thu 28 Oct 2004 13:56

Post by Ikar » Thu 26 Jan 2006 13:12

Thank you for information.
We reproduced your problem and we will fix it. Fix will be included in the nearest SDAC build. It will be available in about one month.
Please watch for announcements at the forum.

tonibrown
Posts: 7
Joined: Wed 25 Jan 2006 05:14

Post by tonibrown » Mon 30 Jan 2006 07:59

Thank you.... looking forward to it!

tonibrown
Posts: 7
Joined: Wed 25 Jan 2006 05:14

Post by tonibrown » Tue 28 Feb 2006 21:22

Hi,

Any news on when this fix will be available?

Thanks,

Toni

tonibrown
Posts: 7
Joined: Wed 25 Jan 2006 05:14

Post by tonibrown » Sat 01 Jul 2006 03:38

Did this issue ever get fixed?

Thanks,

Toni Brown

Jackson
Posts: 512
Joined: Thu 26 Jan 2006 10:06

Post by Jackson » Mon 03 Jul 2006 10:40

Please download the last SDAC version and try again with TCustomDADataSet.Options.QuoteNames = True.

Post Reply