Page 1 of 1

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

Posted: Wed 25 Jan 2006 05:23
by Guest
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

Posted: Wed 25 Jan 2006 05:25
by tonibrown
tonibrown is my login... sorry just learning how to use this newsgroup!

Posted: Wed 25 Jan 2006 15:41
by Ikar
Please set Options.QuoteNames to True and try again.

Posted: Wed 25 Jan 2006 22:23
by tonibrown
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

Posted: Thu 26 Jan 2006 13:12
by Ikar
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.

Posted: Mon 30 Jan 2006 07:59
by tonibrown
Thank you.... looking forward to it!

Posted: Tue 28 Feb 2006 21:22
by tonibrown
Hi,

Any news on when this fix will be available?

Thanks,

Toni

Posted: Sat 01 Jul 2006 03:38
by tonibrown
Did this issue ever get fixed?

Thanks,

Toni Brown

Posted: Mon 03 Jul 2006 10:40
by Jackson
Please download the last SDAC version and try again with TCustomDADataSet.Options.QuoteNames = True.