TMSTable insert mode in Delphi 2007

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
halim1973
Posts: 3
Joined: Wed 11 Aug 2010 16:52

TMSTable insert mode in Delphi 2007

Post by halim1973 » Wed 11 Aug 2010 18:42

I try to insert a new row in my TMStable using mytable.insert --- mytable.post.
My post is not going through. I get the following exception right after a post try.
Exception class: EoleSysError
Exception message: Invalid Class string

Thank you,
-Halim

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Thu 12 Aug 2010 07:58

I can not reproduce the problem.
Please give a more detailed description of the problem. Or try to compose a small sample to demonstrate the problem and send it to dmitryg*devart*com.

halim1973
Posts: 3
Joined: Wed 11 Aug 2010 16:52

Post by halim1973 » Thu 12 Aug 2010 22:05

I just realized that everything was caused by the fact that I have a non null-able uniqueidentifier field in my table. the files is called ClientLocationID.
for some reason the field did not like the Guid string I assigned to it.


PackageTBL.FieldByName('ClientLocationID').AsString :='f0408c6f-ea9f-df11-8793-001e3dee4b37';
Packagetbl.Post;

is there a specific way on how to manipulate uniqueidentifier fields?

Thank you,
-Halim

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 13 Aug 2010 12:19

To create a unique value on the server side, use the NEWID function of SQL Server. You can call this function in the INSERT trigger or use as a default value of the field.

halim1973
Posts: 3
Joined: Wed 11 Aug 2010 16:52

Post by halim1973 » Fri 13 Aug 2010 16:39

Thank you for your response but in my case field : ClientLocationID is a foreign key that links to another table called Clientlocation.
I don't need to generate a new unique ID. I already have it which is :
'f0408c6f-ea9f-df11-8793-001e3dee4b37';

I'm creating a new record for a table called mytable. the user will type in all the information about the table, then select a client location ID from a drop down box, which gives me the clientLocationID which is a uniqueIdentifier type.

-Halim

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Mon 16 Aug 2010 09:28

In this case use the AsString or Value property to assign data.

Post Reply