Board index » cppbuilder » Error creating cursor handle

Error creating cursor handle


2005-04-10 03:01:07 AM
cppbuilder24
Hello!
I am confused and perplexed with the following situation:
I am obtaining with a TQuery an error and, when I replace it with an
instruction TTable->Locate doesn't find a row that exists. Before the two
things had worked me. It is possible that I have erased or unconfigure
something, but I don't remember it.
I have C++ Builder 5 Professional and the files are Paradox.
If it serves as something, I write the corresponding codes, until the
instruction that fails:
1) TTable:
TLocateOptions Opts;
Opts.Clear ();
Opts << loPartialKey;
Variant locvalues[3];
locvalues[0] =
Variant(fInt(GrillaAdmon->Cells[GR_ADMON_SERV][GrillaMes->Row]));
locvalues[1] = Variant(DtMdl->QryServAsignTrabSolap->ParamByName ("
FeIni ") ->AsDateTime);
locvalues[2] = Variant(TrabOld);
DtMdl->TblAsignServ->Open ();
DtMdl->DtbsPpal->StartTransaction ();
try {
if (! (DtMdl->TblAsignServ->Locate
(ConsecServicio;FeDesde;Trabajador",VarArrayOf(locvalues,2), Opts))) {
2) TQuery:
Statement SQL:
UPDATE ASIGNACIONSERVICIOS
SET TRABAJADOR=:TRAB
WHERE CONSECSERVICIO=:SERV AND FEDESDE=:FEDESDE;
Code C++:
QryUpDtTrab->ParamByName (" Serv ") -
Quote
AsInteger=fInt(GrillaAdmon->Cells[GR_ADMON_SERV][GrillaMes->Row]);
QryUpDtTrab->ParamByName (" Trab ") -
AsInteger=fInt(GrillaMes->Cells[GrillaMes->Col][GrillaMes->Row]);
QryUpDtTrab->ParamByName (" FeDesde ") -
AsDateTime=DtMdl->QryServAsignTrabSolap->ParamByName (" FeIni ") -
AsDateTime;
QryUpDtTrab->Prepare ();
QryUpDtTrab->ExecSQL ();
Text of Error:
"Error creating cursor handle."
Thanks in advance.
Guillermo.
 
 

Re:Error creating cursor handle

Sorry!
TTable->Locate is working OK! I had a synchronization problem in Paradox.
But the TQuery (UPDATE) definitively continues giving the error "Error
creating cursor handle"., contrary to the Select that work well.
Thanks any help.
Guillermo.
 

Re:Error creating cursor handle

Hi Guillermo,
What method of the TQuery component are you calling to execute
the SQL "update" command ? "Open()" ?
From the help file :
"Call ExecSQL to execute the SQL statement currently assigned to the SQL
property. Use ExecSQL to execute queries that do not return a cursor to data
(such as INSERT, UPDATE, DELETE, and CREATE TABLE)."
HTH
Jayme.
"Guillermo A. Díaz T." < XXXX@XXXXX.COM >escreveu na mensagem
Quote
Sorry!

TTable->Locate is working OK! I had a synchronization problem in Paradox.

But the TQuery (UPDATE) definitively continues giving the error "Error
creating cursor handle"., contrary to the Select that work well.

Thanks any help.

Guillermo.



 

{smallsort}

Re:Error creating cursor handle

"Guillermo A. Díaz T." < XXXX@XXXXX.COM >wrote:
Quote
Sorry!

TTable->Locate is working OK! I had a synchronization problem in Paradox.

But the TQuery (UPDATE) definitively continues giving the error "Error
creating cursor handle"., contrary to the Select that work well.

Thanks any help.

Guillermo.



Hi,
As Jayme said you cannot use Open() to execute an Update DML.
That's why you're getting the error.
Open is used exclusively to Select commands.
ExecSQL to all the others.
HTH
Antonio