 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
R. Hoek Guest
|
Posted: Mon May 07, 2007 6:53 pm Post subject: Updating GUID-field for ADO.NET in Delphi 2005 |
|
|
For some reason, when I'm trying to update a GUID field, an error occures.
I've create a very simple application using a MSDE database, with two
uniqueidentifier fields. I'm using TADOConnection and a TADOQuery.
This is what I do....
ADOQuery1.SQL.Text := 'Select * from ADMINS order by [ID]';
ADOQuery1.Open;
ADOQuery1.Edit;
ADOQuery1.FieldByName('SID_LOCK').Value := Guid.NewGuid.ToString();
ADOQuery1.Post; <---- Error!!!
The error is: Bij een bewerking die uit meerdere stappen bestaat, is een
fout opgetreden. Controleer alle statuswaarden.
Translated (as good as it could): During an operation with multiple steps,
an error ocurred. Check all statusvalues.
I'm running Windows XP (NL) with Delphi 2005 SP3
--
Regards,
Ronald Hoek
Applicationdevelopper
ComponentAgro B.V. |
|
| Back to top |
|
 |
R. Hoek Guest
|
Posted: Mon May 07, 2007 6:59 pm Post subject: Re: Updating GUID-field for ADO.NET in Delphi 2005 |
|
|
A addition to this question:
- Is the GUID-type field (unniqueindentifier) supported on ADO?
--
Regards,
Ronald Hoek
Applicationdevelopper
ComponentAgro B.V. |
|
| Back to top |
|
 |
R. Hoek Guest
|
Posted: Mon May 07, 2007 7:04 pm Post subject: Re: Updating GUID-field for ADO.NET in Delphi 2005 - This DO |
|
|
I'm using the same code for Delphi 6 and then it works perfectly!
--
Regards,
Ronald Hoek
Applicationdevelopper
ComponentAgro B.V. |
|
| Back to top |
|
 |
Brian Bushay TeamB Guest
|
Posted: Tue May 08, 2007 7:17 am Post subject: Re: Updating GUID-field for ADO.NET in Delphi 2005 |
|
|
| Quote: | A addition to this question:
- Is the GUID-type field (unniqueindentifier) supported on ADO?
Yes. Type AdGuid |
--
Brian Bushay (TeamB)
Bbushay (AT) NMPLS (DOT) com |
|
| Back to top |
|
 |
R. Hoek Guest
|
Posted: Tue May 08, 2007 2:19 pm Post subject: Re: Updating GUID-field for ADO.NET in Delphi 2005 - found t |
|
|
I Found the error to be an problem with using the Guid.ToString() method of
the .NET framework in conjuction with the way the TGUIDField is used by
Borland.
In the Unit "DB" at line 7387 (implementation of the TGuidField.SetAsGuid)
procedure TGuidField.SetAsGuid(const Value: TGUID);
begin
SetAsString(GuidToString(Value));
end;
This uses the function "GUIDToString" in Unit "SysUtils" at line 6666
function GUIDToString(const GUID: Borland.Delphi.System.TGUID): string;
begin
Result := GUID.ToString;
end;
As you can see, this routine uses the GUID.ToString method. The problem wit
this, is that the function returns the GUID without the {} around it, thus
resuting in aan error when posting this data to the ADORecordSet....
This will propebly affect all TDataset descendents which use the TGuidField
and setting it using "AsGUID"....
When u use this kind of field and use the AsString property by setting the
GUId with the correct syntax
AsString := '{' + Guid.ToString() + '}'
No problem will occure....
--
Regards,
Ronald Hoek
Applicationdevelopper
ComponentAgro B.V.
"R. Hoek" <*nospam*hoek (AT) componentagro (DOT) nl*nospam*> schreef in bericht
news:463f2f43$1 (AT) newsgroups (DOT) borland.com...
| Quote: | For some reason, when I'm trying to update a GUID field, an error occures.
I've create a very simple application using a MSDE database, with two
uniqueidentifier fields. I'm using TADOConnection and a TADOQuery.
This is what I do....
ADOQuery1.SQL.Text := 'Select * from ADMINS order by [ID]';
ADOQuery1.Open;
ADOQuery1.Edit;
ADOQuery1.FieldByName('SID_LOCK').Value := Guid.NewGuid.ToString();
ADOQuery1.Post; <---- Error!!!
The error is: Bij een bewerking die uit meerdere stappen bestaat, is een
fout opgetreden. Controleer alle statuswaarden.
Translated (as good as it could): During an operation with multiple steps,
an error ocurred. Check all statusvalues.
I'm running Windows XP (NL) with Delphi 2005 SP3
--
Regards,
Ronald Hoek
Applicationdevelopper
ComponentAgro B.V.
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|