SQLUpdate???
SQLUpdate???
Hi,
any example of using SQLUpdate (C++Builder)?
I can't use a simple update statement in the TMyQuery component.
If I set it to the SQL propety:
update apparts set selection = 'N' ;
A call to Open() doesn't work.
ExecSQL() is not implemented.
Then I guess I'm supposed to set that SQL statement into
the TMyQuery SQLUpdate property.
Ok and then what???
How do I execute it?
Sorry, but nothing is in the (poor) documentation.
So any help with a real C++ example would be appreciated.
any example of using SQLUpdate (C++Builder)?
I can't use a simple update statement in the TMyQuery component.
If I set it to the SQL propety:
update apparts set selection = 'N' ;
A call to Open() doesn't work.
ExecSQL() is not implemented.
Then I guess I'm supposed to set that SQL statement into
the TMyQuery SQLUpdate property.
Ok and then what???
How do I execute it?
Sorry, but nothing is in the (poor) documentation.
So any help with a real C++ example would be appreciated.
Sorry, but this doesn't work.
Execute doesn't do anything.
So I guessed I then had to commit the changes, so I added ApplyUpdates, which complains about a "closed dataset"...
dataContainer->qryGeneric->Close() ;
dataContainer->qryGeneric->SQL->Clear() ;
dataContainer->qryGeneric->SQL->Add(
"update apparts set selection = 'N' " ) ;
// Execute doesn't post the changes
dataContainer->qryGeneric->Execute() ;
// Apply Updates complains about qryGeneric being closed
dataContainer->qryGeneric->ApplyUpdates() ;
What's wrong?
Execute doesn't do anything.
So I guessed I then had to commit the changes, so I added ApplyUpdates, which complains about a "closed dataset"...
dataContainer->qryGeneric->Close() ;
dataContainer->qryGeneric->SQL->Clear() ;
dataContainer->qryGeneric->SQL->Add(
"update apparts set selection = 'N' " ) ;
// Execute doesn't post the changes
dataContainer->qryGeneric->Execute() ;
// Apply Updates complains about qryGeneric being closed
dataContainer->qryGeneric->ApplyUpdates() ;
What's wrong?
Yes I need to reset all the records.
The Execute() works, but nothing at all is changed in the table.
There should be something similar to a COMMIT somewhere.
Sending a complete sample is kind of difficult since you don't have the table and other components.
But here is the code:
// Reset to N all records
qryGeneric->Close() ;
qryGeneric->SQL->Clear() ;
qryGeneric->SQL->Add(
"UPDATE apparts SET selection='N' ;" ) ;
qryGeneric->Execute() ;
// Then select the list again
qryGeneric->Close() ;
qryGeneric->SQL->Clear() ;
qryGeneric->SQL->Add(
"SELECT ap.*, im.adresse FROM apparts ap, immeubles im "
"WHERE ap.dateresiliation IS NOT NULL AND "
"ap.dateremiselocation IS NULL AND ap.noimmeuble = im.noimmeuble;" ) ;
qryGeneric->Open() ;
The Execute() works, but nothing at all is changed in the table.
There should be something similar to a COMMIT somewhere.
Sending a complete sample is kind of difficult since you don't have the table and other components.
But here is the code:
// Reset to N all records
qryGeneric->Close() ;
qryGeneric->SQL->Clear() ;
qryGeneric->SQL->Add(
"UPDATE apparts SET selection='N' ;" ) ;
qryGeneric->Execute() ;
// Then select the list again
qryGeneric->Close() ;
qryGeneric->SQL->Clear() ;
qryGeneric->SQL->Add(
"SELECT ap.*, im.adresse FROM apparts ap, immeubles im "
"WHERE ap.dateresiliation IS NOT NULL AND "
"ap.dateremiselocation IS NULL AND ap.noimmeuble = im.noimmeuble;" ) ;
qryGeneric->Open() ;