 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Phillip Davis Guest
|
Posted: Tue Nov 16, 2004 12:25 am Post subject: Return Status for SQL UPDATE call |
|
|
Hello,
I am using BCB 6 and MS SQL Server for my db application. I may want to
migrate to another DB type later on, so I am staying away from SQL servers
stored procedures. What I would like to know is how I can obtain the server
status of the query that was sent for an update call.Below is the function I
am working with, but I get a Error creating cursor handle message.
Thanks,
Phillip
int __fastcall TDBForm::UpdateClientInfo(TCLIENTINFO *info)
{
int iRetCode = GOODRETCODE;
// Query host session
TQuery *Query = NULL;
Query = new TQuery(Application);
Query->DatabaseName = ALIASNAME;
try {
AnsiString SQLString =
" DECLARE @error int UPDATE renterinfo SET LastName = 'Smith' where Phone =
'800-555-1212' SELECT @error = @@ERROR";
//Clear any existing strings and initialize the insert sql object
properties
Query->SQL->Clear();
Query->SQL->Add(SQLString);
// Query->ExecSQL();
Query->Open();
if (Query ->RecordCount == 0)
iRetCode = BADRETCODE;
else if (Query ->RecordCount > 0) {
int miSQLError = Query ->FieldByName("error")->AsInteger;
if (miSQLError != 0) {
iRetCode = BADRETCODE;
}
}
}
catch (Exception &exception) {
iRetCode = BADRETCODE;
ShowMessage(exception.Message.c_str());
}
delete Query;
return iRetCode;
}
|
|
| 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
|
|