Page 1 of 1
TMSTable insert mode in Delphi 2007
Posted: Wed 11 Aug 2010 18:42
by halim1973
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
Posted: Thu 12 Aug 2010 07:58
by Dimon
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.
Posted: Thu 12 Aug 2010 22:05
by halim1973
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
Posted: Fri 13 Aug 2010 12:19
by Dimon
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.
Posted: Fri 13 Aug 2010 16:39
by halim1973
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
Posted: Mon 16 Aug 2010 09:28
by Dimon
In this case use the AsString or Value property to assign data.