BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Return Status for SQL UPDATE call

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
Phillip Davis
Guest





PostPosted: Tue Nov 16, 2004 12:25 am    Post subject: Return Status for SQL UPDATE call Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.