Exception after insert

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
FerCastro
Posts: 47
Joined: Mon 26 Jun 2006 17:32
Location: México City
Contact:

Exception after insert

Post by FerCastro » Mon 12 Mar 2007 01:22

Hello friends,

After i execute one query for insert i get the next exception message:

"Query must return exactly one result set - use Execute"

Does anybody knows hy this message? What am i doing wrong?

Best Regards

Fernando Castro
México DF

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

Post by Jackson » Mon 12 Mar 2007 08:59

Probably you are trying to use the TDataSet.Open method or the TDataSet.Active property to execute the INSERT statement.
You should use the TCustomDADataSet.Execute method instead.

FerCastro
Posts: 47
Joined: Mon 26 Jun 2006 17:32
Location: México City
Contact:

Hello

Post by FerCastro » Mon 12 Mar 2007 15:42

I show my code,

Please if you see anything wrong let me know. The record is written in the table but i get the error message.

Best regards!

----

DM.QEdita388.SQL := cCadena;
DM.QEdita388.Active:= TRUE;
DM.QEdita388.Execute;

----

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

Post by Jackson » Tue 13 Mar 2007 11:36

There is no need to set TDataSet.Active property to True. Just remove the following code from your example and try again:
DM.QEdita388.Active:= TRUE;

FerCastro
Posts: 47
Joined: Mon 26 Jun 2006 17:32
Location: México City
Contact:

EvgeniyM

Post by FerCastro » Tue 13 Mar 2007 15:22

Thanks a lot for your help. I did what you said and after the change the code is working great.

Thanks

Fernando Castro
Mexico DF

Post Reply