SQLExecute 函数SQLExecute Function

符合性Conformance
版本引入了:ODBC 1.0 标准符合性:ISO 92Version Introduced: ODBC 1.0 Standards Compliance: ISO 92

摘要Summary
SQLExecute执行已准备的语句,使用参数标记变量的当前值,如果在语句中存在任何参数标记。SQLExecute executes a prepared statement, using the current values of the parameter marker variables if any parameter markers exist in the statement.

语法Syntax

  
SQLRETURN SQLExecute(  
     SQLHSTMT     StatementHandle);  

参数Arguments

StatementHandleStatementHandle
[输入]语句句柄。[Input] Statement handle.

返回Returns

SQL_SUCCESS、 SQL_SUCCESS_WITH_INFO、 SQL_NEED_DATA、 SQL_STILL_EXECUTING、 SQL_ERROR、 SQL_NO_DATA、 SQL_INVALID_HANDLE 或 SQL_PARAM_DATA_AVAILABLE。SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_NEED_DATA, SQL_STILL_EXECUTING, SQL_ERROR, SQL_NO_DATA, SQL_INVALID_HANDLE, or SQL_PARAM_DATA_AVAILABLE.

诊断Diagnostics

SQLExecute返回 SQL_ERROR 或 SQL_SUCCESS_WITH_INFO,可以通过调用获取关联的 SQLSTATE 值SQLGetDiagRecHandleType的SQL_HANDLE_STMT 和一个处理StatementHandleWhen SQLExecute returns either SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value can be obtained by calling SQLGetDiagRec with a HandleType of SQL_HANDLE_STMT and a Handle of StatementHandle. 下表列出了通常返回的 SQLSTATE 值SQLExecute ,并解释了此函数; 每个上下文中的表示法"(数据挖掘)"之前 SQLSTATEs 返回由驱动程序管理器的说明。The following table lists the SQLSTATE values commonly returned by SQLExecute and explains each one in the context of this function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the Driver Manager. 与每个 SQLSTATE 值关联的返回代码是 SQL_ERROR,除非另有说明。The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.

SQLSTATESQLSTATE ErrorError 描述Description
0100001000 常规警告General warning 特定于驱动程序的信息性消息。Driver-specific informational message. (函数返回 SQL_SUCCESS_WITH_INFO。)(Function returns SQL_SUCCESS_WITH_INFO.)
0100101001 游标操作冲突Cursor operation conflict 已准备的语句与相关联StatementHandle包含定位的 update 或 delete 语句,并且没有行或多个行未更新或删除。The prepared statement associated with the StatementHandle contained a positioned update or delete statement, and no rows or more than one row were updated or deleted. (有关对多个行的更新的详细信息,请参阅说明 SQL_ATTR_SIMULATE_CURSOR特性SQLSetStmtAttr。)(For more information about updates to more than one row, see the description of the SQL_ATTR_SIMULATE_CURSOR Attribute in SQLSetStmtAttr.)

(函数返回 SQL_SUCCESS_WITH_INFO。)(Function returns SQL_SUCCESS_WITH_INFO.)
0100301003 Set 函数中消除了空值NULL value eliminated in set function 已准备的语句与相关联StatementHandle包含一个集函数 (如AVG最大MIN,依此类推),但不是计数设置函数,并且 NULL 参数值在应用函数之前已被消除。The prepared statement associated with StatementHandle contained a set function (such as AVG, MAX, MIN, and so on), but not the COUNT set function, and NULL argument values were eliminated before the function was applied. (函数返回 SQL_SUCCESS_WITH_INFO。)(Function returns SQL_SUCCESS_WITH_INFO.)
0100401004 字符串数据,右截断String data, right truncated 字符串或二进制数据返回为输出参数时截断了非空白字符或非 NULL 的二进制数据。String or binary data returned for an output parameter resulted in the truncation of nonblank character or non-NULL binary data. 如果它是一个字符串值,它是右侧被截断。If it was a string value, it was right-truncated. (函数返回 SQL_SUCCESS_WITH_INFO。)(Function returns SQL_SUCCESS_WITH_INFO.)
0100601006 未撤消特权Privilege not revoked 已准备的语句与相关联StatementHandle撤消语句,并且用户不具有指定的特权。The prepared statement associated with the StatementHandle was a REVOKE statement, and the user did not have the specified privilege. (函数返回 SQL_SUCCESS_WITH_INFO。)(Function returns SQL_SUCCESS_WITH_INFO.)
0100701007 未授予特权Privilege not granted 已准备的语句与相关联StatementHandle授予语句,并且用户可能不授予指定的特权。The prepared statement associated with the StatementHandle was a GRANT statement, and the user could not be granted the specified privilege.
01S0201S02 选项值已更改Option value changed 指定的语句属性实现运行情况,由于无效,因此已暂时替换一个相近的值。A specified statement attribute was invalid because of implementation working conditions, so a similar value was temporarily substituted. (SQLGetStmtAttr可以调用以确定暂时被替换的值是什么。)替换值是否为有效StatementHandle直到关闭游标,此时语句属性将恢复为以前的值。(SQLGetStmtAttr can be called to determine what the temporarily substituted value is.) The substitute value is valid for the StatementHandle until the cursor is closed, at which point the statement attribute reverts to its previous value. 可以更改的语句属性有:Sql_attr_concurrency 设置 SQL_ATTR_CURSOR_TYPE、 SQL_ATTR_KEYSET_SIZE、 SQL_ATTR_MAX_LENGTH、 SQL_ATTR_MAX_ROWS、 SQL_ATTR_QUERY_TIMEOUT 和 SQL_ATTR_SIMULATE_CURSOR。The statement attributes that can be changed are: SQL_ATTR_CONCURRENCY, SQL_ATTR_CURSOR_TYPE, SQL_ATTR_KEYSET_SIZE, SQL_ATTR_MAX_LENGTH, SQL_ATTR_MAX_ROWS, SQL_ATTR_QUERY_TIMEOUT, and SQL_ATTR_SIMULATE_CURSOR. (函数返回 SQL_SUCCESS_WITH_INFO。)(Function returns SQL_SUCCESS_WITH_INFO.)
01S0701S07 截断小数部分Fractional truncation 用于输入/输出返回的数据或输出参数已被截断数值数据类型的小数部分被截断或时间部分的时间、 时间戳或时间间隔的数据类型的小数部分被截断。The data returned for an input/output or output parameter was truncated such that the fractional part of a numeric data type was truncated or the fractional portion of the time component of a time, timestamp, or interval data type was truncated.

(函数返回 SQL_SUCCESS_WITH_INFO。)(Function returns SQL_SUCCESS_WITH_INFO.)
0700207002 COUNT 字段不正确COUNT field incorrect 在指定的参数数目SQLBindParameter中包含的 SQL 语句中的参数数量小于* StatementTextThe number of parameters specified in SQLBindParameter was less than the number of parameters in the SQL statement contained in *StatementText.

SQLBindParameter调用时使用ParameterValuePtr设置为 null 指针StrLen_or_IndPtr未设置为 SQL_NULL_DATA 或 SQL_DATA_AT_EXEC,和InputOutputType不将设置为 SQL_PARAM_OUTPUT,以便在指定的参数数目SQLBindParameter大于中包含的 SQL 语句中的参数数目 *StatementText.SQLBindParameter was called with ParameterValuePtr set to a null pointer, StrLen_or_IndPtr not set to SQL_NULL_DATA or SQL_DATA_AT_EXEC, and InputOutputType not set to SQL_PARAM_OUTPUT, so that the number of parameters specified in SQLBindParameter was greater than the number of parameters in the SQL statement contained in *StatementText.
0700607006 受限制的数据类型属性冲突Restricted data type attribute violation 标识的数据值ValueType中的参数SQLBindParameter无法为数据类型由标识转换绑定的参数为ParameterType中的参数SQLBindParameterThe data value identified by the ValueType argument in SQLBindParameter for the bound parameter could not be converted to the data type identified by the ParameterType argument in SQLBindParameter.

参数绑定为 SQL_PARAM_INPUT_OUTPUT 或 SQL_PARAM_OUTPUT 不无法转换为标识的数据类型返回的数据值ValueType中的参数SQLBindParameterThe data value returned for a parameter bound as SQL_PARAM_INPUT_OUTPUT or SQL_PARAM_OUTPUT could not be converted to the data type identified by the ValueType argument in SQLBindParameter.

(如果无法转换为一个或多个行的数据值,但没有成功返回一个或多个行,此函数返回 SQL_SUCCESS_WITH_INFO。)(If the data values for one or more rows could not be converted but one or more rows were successfully returned, this function returns SQL_SUCCESS_WITH_INFO.)
0700707007 受限制的参数值冲突Restricted parameter value violation 参数类型 SQL_PARAM_INPUT_OUTPUT_STREAM 仅用于发送和接收数据部分中的参数。The parameter type SQL_PARAM_INPUT_OUTPUT_STREAM is only used for a parameter that sends and receives data in parts. 输入此参数类型不允许绑定的缓冲区。An input bound buffer is not allowed for this parameter type.

参数类型是 SQL_PARAM_INPUT_OUTPUT,以及时,将发生此错误* StrLen_or_IndPtr中指定SQLBindParameter不等于 SQL_NULL_DATA,SQL_DEFAULT_PARAM、 SQL_LEN_DATA_AT_EXEC(len) 或 SQL_DATA_AT_EXEC。This error will occur when the parameter type is SQL_PARAM_INPUT_OUTPUT, and when the *StrLen_or_IndPtr specified in SQLBindParameter is not equal to SQL_NULL_DATA, SQL_DEFAULT_PARAM, SQL_LEN_DATA_AT_EXEC(len), or SQL_DATA_AT_EXEC.
07S0107S01 默认参数的使用无效Invalid use of default parameter 参数值,设置SQLBindParameter、 是 SQL_DEFAULT_PARAM,和相应的参数不是 ODBC 规范的过程调用的参数。A parameter value, set with SQLBindParameter, was SQL_DEFAULT_PARAM, and the corresponding parameter was not a parameter for an ODBC canonical procedure invocation.
08S0108S01 通讯链接失败Communication link failure 该驱动程序和驱动程序已连接到数据源之间的通信链接失败之前函数已完成处理。The communication link between the driver and the data source to which the driver was connected failed before the function completed processing.
21S0221S02 派生表等级与列列表不匹配Degree of derived table does not match column list 已准备的语句与相关联StatementHandle包含CREATE VIEW语句和非限定的列列表 (图中指定的列数列标识符SQL 语句的参数) 包含定义的派生表中的列数与多个名称,查询规范SQL 语句的参数。The prepared statement associated with the StatementHandle contained a CREATE VIEW statement, and the unqualified column list (the number of columns specified for the view in the column-identifier arguments of the SQL statement) contained more names than the number of columns in the derived table defined by the query-specification argument of the SQL statement.
2200122001 字符串数据,右截断String data, right truncation 字符或二进制值的列分配导致非空白 (字符) 或非 null (二进制) 字符或字节数的截断。The assignment of a character or binary value to a column resulted in the truncation of nonblank (character) or non-null (binary) characters or bytes.
2200222002 需要指示器变量,但未提供Indicator variable required but not supplied NULL 数据被绑定到一个输出参数,其StrLen_or_IndPtr设置SQLBindParameter是空指针。NULL data was bound to an output parameter whose StrLen_or_IndPtr set by SQLBindParameter was a null pointer.
2200322003 数值超出范围Numeric value out of range 已准备的语句与相关联StatementHandle包含绑定的数值参数,并且参数值导致要分配给关联时被截断的数字的整个 (而不是小数) 部分表的列。The prepared statement associated with the StatementHandle contained a bound numeric parameter, and the parameter value caused the whole (as opposed to fractional) part of the number to be truncated when assigned to the associated table column.

返回一个数字值 (数值或字符串) 的一个或多个输入/输出参数或输出参数将导致要截断的数字的整个 (而不是小数) 部分。Returning a numeric value (as numeric or string) for one or more input/output or output parameters would have caused the whole (as opposed to fractional) part of the number to be truncated.
2200722007 日期时间格式无效Invalid datetime format 已准备的语句与相关联StatementHandle包含 SQL 语句包含日期、 时间戳结构作为绑定参数,并且是该参数,分别、 无效的日期、 时间,或时间戳。The prepared statement associated with the StatementHandle contained an SQL statement that contained a date, time, or timestamp structure as a bound parameter, and the parameter was, respectively, an invalid date, time, or timestamp.

输入/输出或输出参数绑定到日期、 时间或时间戳 C 结构,返回的参数中的值时,分别,无效的日期、 时间戳。An input/output or output parameter was bound to a date, time, or timestamp C structure, and a value in the returned parameter was, respectively, an invalid date, time, or timestamp. (函数返回 SQL_SUCCESS_WITH_INFO。)(Function returns SQL_SUCCESS_WITH_INFO.)
2200822008 日期时间字段溢出Datetime field overflow 已准备的语句与相关联StatementHandle包含包含日期时间表达式,计算,产生的日期时间戳结构的 SQL 语句无效。The prepared statement associated with the StatementHandle contained an SQL statement that contained a datetime expression that, when computed, resulted in a date, time, or timestamp structure that was invalid.

日期时间表达式计算的输入/输出或输出参数导致了日期、 时间或时间戳 C 结构无效。A datetime expression computed for an input/output or output parameter resulted in a date, time, or timestamp C structure that was invalid.
2201222012 被零除Division by zero 已准备的语句与相关联StatementHandle包含导致被零除的算术表达式。The prepared statement associated with the StatementHandle contained an arithmetic expression that caused division by zero.

算术表达式计算的输入/输出或输出参数导致除零。An arithmetic expression calculated for an input/output or output parameter resulted in division by zero.
2201522015 间隔字段溢出Interval field overflow *StatementText包含一个确切的数值或时间间隔参数,当转换到 SQL 数据类型的时间间隔,导致重要数字丢失。*StatementText contained an exact numeric or interval parameter that, when converted to an interval SQL data type, caused a loss of significant digits.

*StatementText包含多个字段是间隔参数,当转换为数值数据类型列中,没有表示形式具有数值数据类型。*StatementText contained an interval parameter with more than one field that, when converted to a numeric data type in a column, had no representation in the numeric data type.

*StatementText包含已分配到的时间间隔 SQL 类型的参数数据,并且在时间间隔内 SQL 类型的 C 类型的值没有表示形式。*StatementText contained parameter data that was assigned to an interval SQL type, and there was no representation of the value of the C type in the interval SQL type.

分配为精确数字或间隔时导致重要数字丢失 C 间隔类型到 SQL 类型的输入/输出或输出参数。Assigning an input/output or output parameter that was an exact numeric or interval SQL type to an interval C type caused a loss of significant digits.

输入/输出或输出参数分配给一个 C 间隔结构,间隔数据结构中的数据没有表示形式。When an input/output or output parameter was assigned to an interval C structure, there was no representation of the data in the interval data structure.
2201822018 转换指定的字符值无效Invalid character value for cast specification *StatementText包含 C 类型的为准确或近似数值、 日期时间或间隔数据类型; 该列的 SQL 类型是字符数据类型; 和列中的值不是有效的绑定 C 类型的文本。*StatementText contained a C type that was an exact or approximate numeric, a datetime, or an interval data type; the SQL type of the column was a character data type; and the value in the column was not a valid literal of the bound C type.

SQL 类型时返回的输入/输出或输出参数,已准确或近似数值、 日期时间或间隔数据类型;C 类型为 SQL_C_CHAR;和列中的值不是有效的绑定的 SQL 类型的文本。When an input/output or output parameter was returned, the SQL type was an exact or approximate numeric, a datetime, or an interval data type; the C type was SQL_C_CHAR; and the value in the column was not a valid literal of the bound SQL type.
2201922019 无效的转义字符Invalid escape character 已准备的语句与相关联StatementHandle包含谓词以及转义其中子句,并之后的转义字符的长度转义不是等于 1。The prepared statement associated with StatementHandle contained a LIKE predicate with an ESCAPE in the WHERE clause, and the length of the escape character following ESCAPE was not equal to 1.
2202522025 无效的转义序列Invalid escape sequence 已准备的语句与相关联StatementHandle包含"模式值转义转义字符"中其中子句和后面的模式值中的转义字符的字符不是之一"%"或""。The prepared statement associated with StatementHandle contained "LIKE pattern value ESCAPE escape character" in the WHERE clause, and the character following the escape character in the pattern value was not one of "%" or "".
2300023000 完整性约束冲突Integrity constraint violation 已准备的语句与相关联StatementHandle包含参数。The prepared statement associated with the StatementHandle contained a parameter. 参数值为空的定义为 NOT NULL 列关联的表中的列、 列约束为仅包含唯一值,却提供了重复的值或违反了某个其他的完整性约束。The parameter value was NULL for a column defined as NOT NULL in the associated table column, a duplicate value was supplied for a column constrained to contain only unique values, or some other integrity constraint was violated.
2400024000 游标状态无效Invalid cursor state 在光标StatementHandle通过SQLFetchSQLFetchScrollA cursor was positioned on the StatementHandle by SQLFetch or SQLFetchScroll. 如果此错误返回由驱动程序管理器SQLFetchSQLFetchScroll未返回 SQL_NO_DATA,和如果驱动程序返回SQLFetchSQLFetchScroll已返回 sql_no_data 为止。This error is returned by the Driver Manager if SQLFetch or SQLFetchScroll has not returned SQL_NO_DATA, and is returned by the driver if SQLFetch or SQLFetchScroll has returned SQL_NO_DATA.

在打开游标的StatementHandleA cursor was open on the StatementHandle.

已准备的语句与相关联StatementHandle包含定位的更新或删除 statemen、 t 和光标所处的结果集或结果集的末尾之后在开始之前。The prepared statement associated with the StatementHandle contained a positioned update or delete statemen,t and the cursor was positioned before the start of the result set or after the end of the result set.
4000140001 序列化失败Serialization failure 事务已回滚,由于其他事务与资源死锁。The transaction was rolled back due to a resource deadlock with another transaction.
4000340003 语句完成情况未知Statement completion unknown 此函数中,在执行期间失败关联的连接,无法确定事务的状态。The associated connection failed during the execution of this function, and the state of the transaction cannot be determined.
4200042000 语法错误或访问冲突Syntax error or access violation 用户没有执行已准备的语句与关联的权限StatementHandleThe user did not have permission to execute the prepared statement associated with the StatementHandle.
4400044000 WITH CHECK OPTION 冲突WITH CHECK OPTION violation 已准备的语句与相关联StatementHandle包含插入上查看的表执行的语句或派生自创建通过指定查看表的表WITH CHECK OPTION,这样,受影响的一个或多个行插入语句无法再查看表中存在。The prepared statement associated with StatementHandle contained an INSERT statement performed on a viewed table or a table derived from the viewed table that was created by specifying WITH CHECK OPTION, such that one or more rows affected by the INSERT statement will no longer be present in the viewed table.

已准备的语句与相关联StatementHandle包含更新上查看的表执行的语句或派生自创建通过指定查看表的表WITH CHECK OPTION,这样,受影响的一个或多个行更新语句无法再查看表中存在。The prepared statement associated with the StatementHandle contained an UPDATE statement performed on a viewed table or a table derived from the viewed table that was created by specifying WITH CHECK OPTION, such that one or more rows affected by the UPDATE statement will no longer be present in the viewed table.
HY000HY000 常规错误General error 有关其中没有任何特定的 SQLSTATE 和为其定义任何特定于实现的 SQLSTATE 出错。An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. 返回的错误消息SQLGetDiagRec*MessageText缓冲区描述错误以及其原因。The error message returned by SQLGetDiagRec in the *MessageText buffer describes the error and its cause.
HY001HY001 内存分配错误Memory allocation error 该驱动程序无法分配支持执行或完成该函数所需的内存。The driver was unable to allocate memory required to support execution or completion of the function.
HY008HY008 操作已取消Operation canceled 异步处理的已启用StatementHandleAsynchronous processing was enabled for the StatementHandle. 调用该函数,和之前执行完毕SQLCancelSQLCancelHandle上调用了StatementHandleThe function was called, and before it completed execution, SQLCancel or SQLCancelHandle was called on the StatementHandle. 然后在再次调用该函数StatementHandleThen the function was called again on the StatementHandle.

调用该函数,和之前执行完毕SQLCancelSQLCancelHandle上调用了StatementHandle来自不同线程中多线程应用程序。The function was called, and before it completed execution, SQLCancel or SQLCancelHandle was called on the StatementHandle from a different thread in a multithread application.
HY010HY010 函数序列错误Function sequence error (DM) 为与之关联的连接句柄调用以异步方式执行的函数StatementHandle(DM) An asynchronously executing function was called for the connection handle that is associated with the StatementHandle. 此异步函数仍在执行时SQLExecute调用函数。This asynchronous function was still executing when the SQLExecute function was called.

(数据挖掘) SQLExecuteSQLExecDirect,或SQLMoreResults曾为StatementHandle和返回 SQL_PARAM_DATA_可用。(DM) SQLExecute, SQLExecDirect, or SQLMoreResults was called for the StatementHandle and returned SQL_PARAM_DATA_AVAILABLE. 数据已检索到的所有经过流处理参数之前调用此函数。This function was called before data was retrieved for all streamed parameters.

(DM) 的调用以异步方式执行的函数 (不是此类似) StatementHandle和仍在执行时调用此函数。(DM) An asynchronously executing function (not this one) was called for the StatementHandle and was still executing when this function was called.

(数据挖掘) SQLExecuteSQLExecDirectSQLBulkOperations,或者SQLSetPos曾为StatementHandle和返回 SQL_NEED_DATA。(DM) SQLExecute, SQLExecDirect, SQLBulkOperations, or SQLSetPos was called for the StatementHandle and returned SQL_NEED_DATA. 数据已发送的所有执行时数据参数或列之前调用此函数。This function was called before data was sent for all data-at-execution parameters or columns.

(数据挖掘) StatementHandle未准备好。(DM) The StatementHandle was not prepared.
HY013HY013 内存管理错误Memory management error 无法处理函数调用,因为基础内存对象无法访问,可能是由于内存不足的情况。The function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.
HY090HY090 字符串或缓冲区长度无效Invalid string or buffer length 参数值,设置SQLBindParameter、 是空指针和参数长度值不是 0,SQL_NULL_DATA,SQL_DATA_AT_EXEC,SQL_DEFAULT_PARAM,或小于或等于 SQL_LEN_DATA_AT_EXEC_OFFSET。A parameter value, set with SQLBindParameter, was a null pointer, and the parameter length value was not 0, SQL_NULL_DATA, SQL_DATA_AT_EXEC, SQL_DEFAULT_PARAM, or less than or equal to SQL_LEN_DATA_AT_EXEC_OFFSET.

参数值,设置SQLBindParameter、 不是空指针; C 数据类型为 SQL_C_BINARY 或 SQL_C_CHAR; 和参数长度值是小于 0,但不是 SQL_NTS、 SQL_NULL_DATA、 SQL_DEFAULT_PARAM 或 SQL_DATA_AT_EXEC,或小于或等于 SQL_LEN_DATA_AT_EXEC_OFFSET。A parameter value, set with SQLBindParameter, was not a null pointer; the C data type was SQL_C_BINARY or SQL_C_CHAR; and the parameter length value was less than 0 but was not SQL_NTS, SQL_NULL_DATA, SQL_DEFAULT_PARAM, or SQL_DATA_AT_EXEC, or less than or equal to SQL_LEN_DATA_AT_EXEC_OFFSET.

参数长度值受SQLBindParameter为设置为 SQL_DATA_AT_EXEC; 的 SQL 类型为 SQL_LONGVARCHAR、 SQL_LONGVARBINARY、 或 long 数据源特定的数据类型; 和 SQL_NEED_LONG_DATA_LEN 信息在键入SQLGetInfo是"Y"。A parameter length value bound by SQLBindParameter was set to SQL_DATA_AT_EXEC; the SQL type was either SQL_LONGVARCHAR, SQL_LONGVARBINARY, or a long data source-specific data type; and the SQL_NEED_LONG_DATA_LEN information type in SQLGetInfo was "Y".
HY105HY105 无效的参数类型Invalid parameter type 为参数指定的值InputOutputTypeSQLBindParameter SQL_PARAM_OUTPUT,而该参数是输入的参数。The value specified for the argument InputOutputType in SQLBindParameter was SQL_PARAM_OUTPUT, and the parameter was an input parameter.
HY109HY109 无效的游标位置Invalid cursor position 已准备的语句已定位的 update 或 delete 语句和光标定位已 (通过SQLSetPosSQLFetchScroll) 上的行已删除或无法提取。The prepared statement was a positioned update or delete statement, and the cursor was positioned (by SQLSetPos or SQLFetchScroll) on a row that had been deleted or could not be fetched.
HY117HY117 由于未知的事务状态而挂起连接。Connection is suspended due to unknown transaction state. 仅断开连接,并允许使用只读的函数。Only disconnect and read-only functions are allowed. (DM) 有关挂起状态的详细信息,请参阅SQLEndTran 函数(DM) For more information about suspended state, see SQLEndTran Function.
HYC00HYC00 未实现的可选功能Optional feature not implemented 驱动程序或数据源不支持 SQL_ATTR_CONCURRENCY 和 SQL_ATTR_CURSOR_TYPE 语句属性的当前设置的组合。The combination of the current settings of the SQL_ATTR_CONCURRENCY and SQL_ATTR_CURSOR_TYPE statement attributes was not supported by the driver or data source.

SQL_ATTR_USE_BOOKMARKS 语句属性设置为 SQL_UB_VARIABLE,并且 SQL_ATTR_CURSOR_TYPE 语句属性设置为游标类型,该驱动程序不支持书签。The SQL_ATTR_USE_BOOKMARKS statement attribute was set to SQL_UB_VARIABLE, and the SQL_ATTR_CURSOR_TYPE statement attribute was set to a cursor type for which the driver does not support bookmarks.
HYT00HYT00 超时时间已到Timeout expired 查询超时期限过期之前的数据源返回的结果集。The query timeout period expired before the data source returned the result set. 通过设置超时期限SQLSetStmtAttr,SQL_ATTR_QUERY_TIMEOUT。The timeout period is set through SQLSetStmtAttr, SQL_ATTR_QUERY_TIMEOUT.
HYT01HYT01 连接超时时间已到Connection timeout expired 连接超时期限过期之前的数据源响应此请求。The connection timeout period expired before the data source responded to the request. 通过设置连接超时期SQLSetConnectAttr,SQL_ATTR_CONNECTION_TIMEOUT。The connection timeout period is set through SQLSetConnectAttr, SQL_ATTR_CONNECTION_TIMEOUT.
IM001IM001 驱动程序不支持此函数Driver does not support this function (DM) 驱动程序与相关联StatementHandle不支持该函数。(DM) The driver associated with the StatementHandle does not support the function.
IM017IM017 轮询异步通知模式中禁用Polling is disabled in asynchronous notification mode 只要使用通知模型,将禁用轮询。Whenever the notification model is used, polling is disabled.
IM018IM018 SQLCompleteAsync尚未调用以完成此句柄上以前的异步操作。SQLCompleteAsync has not been called to complete the previous asynchronous operation on this handle. 如果句柄上的上一个函数调用返回 SQL_STILL_EXECUTING,如果启用通知模式,则SQLCompleteAsync必须要对其进行后期处理并完成该操作的句柄上调用。If the previous function call on the handle returns SQL_STILL_EXECUTING and if notification mode is enabled, SQLCompleteAsync must be called on the handle to do post-processing and complete the operation.

SQLExecute可以返回任何可由返回的 SQLSTATE SQLPrepare基于当数据源的计算结果与语句相关联的 SQL 语句。SQLExecute can return any SQLSTATE that can be returned by SQLPrepare, based on when the data source evaluates the SQL statement associated with the statement.

注释Comments

SQLExecute执行准备的语句SQLPrepareSQLExecute executes a statement prepared by SQLPrepare. 应用程序处理或放弃对的调用的结果后SQLExecute,应用程序可以调用SQLExecute再次使用新的参数值。After the application processes or discards the results from a call to SQLExecute, the application can call SQLExecute again with new parameter values. 准备好的执行有关的详细信息,请参阅准备好执行For more information about prepared execution, see Prepared Execution.

若要执行选择语句不止一次,应用程序必须调用SQLCloseCursor继续重新执行选择语句。To execute a SELECT statement more than once, the application must call SQLCloseCursor before reexecuting the SELECT statement.

如果数据源在手动提交模式下 (需要显式事务启动),并且尚未启动事务,驱动程序将启动一个事务发送的 SQL 语句之前。If the data source is in manual-commit mode (requiring explicit transaction initiation) and a transaction has not already been initiated, the driver initiates a transaction before it sends the SQL statement. 有关详细信息,请参阅事务For more information, see Transactions.

如果应用程序使用SQLPrepare准备并SQLExecute提交提交回滚语句,它不是DBMS 产品之间互操作。If an application uses SQLPrepare to prepare and SQLExecute to submit a COMMIT or ROLLBACK statement, it will not be interoperable between DBMS products. 若要提交或回滚事务,调用SQLEndTranTo commit or roll back a transaction, call SQLEndTran.

如果SQLExecute遇到执行时数据参数,它将返回 SQL_NEED_DATA。If SQLExecute encounters a data-at-execution parameter, it returns SQL_NEED_DATA. 应用程序发送的数据使用SQLParamDataSQLPutDataThe application sends the data using SQLParamData and SQLPutData. 请参阅SQLBindParameterSQLParamDataSQLPutData,以及发送长数据See SQLBindParameter, SQLParamData, SQLPutData, and Sending Long Data.

如果SQLExecute执行搜索的 update、 insert 或 delete 语句,但不影响任何行在数据源,调用SQLExecute返回 sql_no_data 为止。If SQLExecute executes a searched update, insert, or delete statement that does not affect any rows at the data source, the call to SQLExecute returns SQL_NO_DATA.

如果将 SQL_ATTR_PARAMSET_SIZE 语句属性的值大于 1,并且 SQL 语句中包含至少一个参数标记, SQLExecute数组中执行的每组参数值一次的 SQL 语句指向 *ParameterValuePtr调用中的自变量SQLBindParameterIf the value of the SQL_ATTR_PARAMSET_SIZE statement attribute is greater than 1 and the SQL statement contains at least one parameter marker, SQLExecute executes the SQL statement once for each set of parameter values in the arrays pointed to by the *ParameterValuePtr argument in the calls to SQLBindParameter. 有关详细信息,请参阅参数值数组For more information, see Arrays of Parameter Values.

如果启用了书签和执行的查询不能支持书签,则驱动程序应尝试强制为通过更改属性值并返回 SQLSTATE 01S02 支持书签环境 (选项值已更改)。If bookmarks are enabled and a query is executed that cannot support bookmarks, the driver should attempt to coerce the environment to one that supports bookmarks by changing an attribute value and returning SQLSTATE 01S02 (Option value changed). 如果不能更改的属性,则驱动程序应返回 SQLSTATE 为 HY024 (无效的属性值)。If the attribute cannot be changed, the driver should return SQLSTATE HY024 (Invalid attribute value).

备注

当使用连接池时,应用程序必须执行 SQL 语句,如更改数据库或数据库的上下文使用_数据库_语句在 SQL Server 中,这会更改使用数据源的目录。When using connection pooling, an application must not execute SQL statements that change the database or the context of the database, such as the USE database statement in SQL Server, which changes the catalog used by a data source.

代码示例Code Example

请参阅SQLBindParameterSQLBulkOperationsSQLPutData,以及SQLSetPosSee SQLBindParameter, SQLBulkOperations, SQLPutData, and SQLSetPos.

有关信息For information about 请参阅See
将缓冲区绑定到结果集中的列Binding a buffer to a column in a result set SQLBindCol 函数SQLBindCol Function
取消语句处理Canceling statement processing SQLCancel 函数SQLCancel Function
关闭游标Closing the cursor SQLCloseCursor 函数SQLCloseCursor Function
执行提交或回滚操作Executing a commit or rollback operation SQLEndTran 函数SQLEndTran Function
执行 SQL 语句Executing an SQL statement SQLExecDirect 函数SQLExecDirect Function
正在提取多行数据Fetching multiple rows of data SQLFetch 函数SQLFetch Function
提取的数据块或滚动浏览结果集Fetching a block of data or scrolling through a result set SQLFetchScroll 函数SQLFetchScroll Function
释放语句句柄Freeing a statement handle SQLFreeStmt 函数SQLFreeStmt Function
返回游标名称Returning a cursor name SQLGetCursorName 函数SQLGetCursorName Function
正在提取部分或全部的数据列Fetching part or all of a column of data SQLGetData 函数SQLGetData Function
返回下一个参数将数据发送用于Returning the next parameter to send data for SQLParamData 函数SQLParamData Function
准备执行的语句Preparing a statement for execution SQLPrepare 函数SQLPrepare Function
在执行时发送参数数据Sending parameter data at execution time SQLPutData 函数SQLPutData Function
设置游标名称Setting a cursor name SQLSetCursorName 函数SQLSetCursorName Function
设置语句属性Setting a statement attribute SQLSetStmtAttr 函数SQLSetStmtAttr Function

请参阅See Also

ODBC API 参考 ODBC API Reference
ODBC 头文件ODBC Header Files