Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C and SQL

Status
Not open for further replies.

stevensteven

Programmer
Jan 5, 2004
108
CA
I am calling a SQL stored procedure from my C code to update a database. The problem is that once I call my stored procedure, in my C code, it creates a result set which cost me alot of time to close the cursor before i perform another query. I have added SET NOCOUNT ON to my SQL Server stored procedure, but in my c code I still get a result set back.

Simplified C code
rc = SQLAllocStmt(hdbc, hstmt);
rc = SQLPrepare(*hstmt, "{call AddAnalog(?,?,?)", SQL_NTS);
rc = SQLNumParams (*hstmt, &numParams);
[BINDPARAMETERS CALL]

while(I am looping)
{
rc = SQLExecute(*hstmt);
rc = SQLFreeStmt(*hstmt, SQL_CLOSE); /* Close Cursor */
}
See the problem is that I don't care what gets return from the stored procedure since all my parameters were inputs. But it takes time to create the record set and to close it before I do another stored procedure call.

Any ideas anyone?


Thanks for any help,

Steven
 
You might want to try the "Microsoft SQL Server: Programming " forum.
 
I am calling a SQL stored procedure from my C code to update a database.

Are you sure the stored procedure you are using perform just update, in other words, does it SELECT a record set somewhere??

Walid Magd
Engwam@Hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top