Download Database - National Instruments

Transcript
Chapter 5
SQL Toolkit Library Reference — DBRefreshParams
DBRefreshParams
int status = DBRefreshParams (int statementHandle);
Purpose
Retrieves provider-side parameter information for the stored procedure or parameterized
query associated with the statement. Using DBRefreshParams can cause your program to
run more slowly than when you specify the parameters with the DBCreateParam functions.
Not all providers or ODBC drivers support DBRefreshParams.
Parameter
Input
Name
statementHandle
Type
Description
integer
Handle to the SQL statement that
DBPrepareSQL returned.
Return Value
Name
status
Type
Description
integer
Result code that DBRefreshParams
returns. This function returns the set of result
codes listed in the function description for
DBError. Use DBErrorMessage to obtain
the text of the error message.
Example
int inParam, outParam, retParam;
...
/* Create the stored procedure. */
resCode = DBImmediateSQL(hdbc, "create proc sp_CVITest( \
@InParam int, @OutParam int OUTPUT ) as select \
@OutParam = @InParam + 10 SELECT * FROM Authors \
WHERE State <> 'CA' return @OutParam +10");
/* Specify that the next command is a stored procedure. */
resCode = DBSetAttributeDefault(hdbc, ATTR_DB_COMMAND_TYPE,
DB_COMMAND_STORED_PROC);
hstmt = DBPrepareSQL (hdbc, "sp_CVItest");
if (hstmt == 0)
LabWindows/CVI SQL Toolkit Reference Manual
5-222
© National Instruments Corporation