Page 1 of 1

Exception after insert

Posted: Mon 12 Mar 2007 01:22
by FerCastro
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

Posted: Mon 12 Mar 2007 08:59
by Jackson
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.

Hello

Posted: Mon 12 Mar 2007 15:42
by FerCastro
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;

----

Posted: Tue 13 Mar 2007 11:36
by Jackson
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;

EvgeniyM

Posted: Tue 13 Mar 2007 15:22
by FerCastro
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