我的选择语句看起来像这样
SELECT tb1.name FROM table1 tb1, table2 tb2 WHERE tb2.name=? AND tb2.tb1_key_id=tb1.id;
我的 Bindparameter 调用看起来像这样
SQLBindParameter(m_hStatement,1,SQL_PARAM_INPUT,SQL_C_CHAR,SQL_CHAR,len,0,(LPVOID)buff,len,(SQLLEN *)pcbValue);
在哪里buff is void*
当我在此语句上运行 SQLExecute 时,SQL_SUCCESS_WITH_INFO
当我查看错误详细信息时,它会返回[Firebird ODBC driver] data truncated
。
我对数据库完全陌生,如果需要更多详细信息,请告诉我
顺便说一句,相同的语句在 32 位应用程序中运行良好,如果在 64 位中编译会出现此问题。
UPDATE
- 再次回到这个问题。
我得到了 SQL 跟踪文件
MyApp 4e0-1680 ENTER SQLPrepareW
HSTMT 0x0000000008C9E210
WCHAR * 0x000000000DF04CE0 [ -3] "SELECT tb1.name FROM table1 tb1, table2 tb2 WHERE tb2.name=? AND tb2.tb1_key_id=tb1.id;\ 0"
SDWORD -3
MyApp 4e0-1680 EXIT SQLPrepareW with return code 0 (SQL_SUCCESS)
HSTMT 0x0000000008C9E210
WCHAR * 0x000000000DF04CE0 [ -3] "SELECT tb1.name FROM table1 tb1, table2 tb2 WHERE tb2.name=? AND tb2.tb1_key_id=tb1.id;\ 0"
SDWORD -3
MyApp 4e0-1680 ENTER SQLBindParameter
HSTMT 0x0000000008C9E210
UWORD 1
SWORD 1 <SQL_PARAM_INPUT>
SWORD 1 <SQL_C_CHAR>
SWORD 1 <SQL_CHAR>
SQLULEN 48
SWORD 0
PTR 0x0000000008B932D0
SQLLEN 48
SQLLEN * 0x0000000008B93008
MyApp 4e0-1680 EXIT SQLBindParameter with return code 0 (SQL_SUCCESS)
HSTMT 0x0000000008C9E210
UWORD 1
SWORD 1 <SQL_PARAM_INPUT>
SWORD 1 <SQL_C_CHAR>
SWORD 1 <SQL_CHAR>
SQLULEN 48
SWORD 0
PTR 0x0000000008B932D0
SQLLEN 48
SQLLEN * 0x0000000008B93008 (4294967293)
MyApp 4e0-1680 ENTER SQLBindParameter
HSTMT 0x0000000008C9E210
UWORD 2
SWORD 1 <SQL_PARAM_INPUT>
SWORD 1 <SQL_C_CHAR>
SWORD 1 <SQL_CHAR>
SQLULEN 48
SWORD 0
PTR 0x0000000008B93298
SQLLEN 48
SQLLEN * 0x0000000008B93008
MyApp 4e0-1680 EXIT SQLBindParameter with return code 0 (SQL_SUCCESS)
HSTMT 0x0000000008C9E210
UWORD 2
SWORD 1 <SQL_PARAM_INPUT>
SWORD 1 <SQL_C_CHAR>
SWORD 1 <SQL_CHAR>
SQLULEN 48
SWORD 0
PTR 0x0000000008B93298
SQLLEN 48
SQLLEN * 0x0000000008B93008 (4294967293)
MyApp 4e0-1680 ENTER SQLExecute
HSTMT 0x0000000008C9E210
MyApp 4e0-1680 EXIT SQLExecute with return code 1 (SQL_SUCCESS_WITH_INFO)
HSTMT 0x0000000008C9E210
DIAG [01004] [ODBC Firebird Driver]Data truncated (0)
DIAG [01004] [ODBC Firebird Driver]Data truncated (0)
MyApp 4e0-1680 ENTER SQLErrorW
HENV 0x0000000000000000
HDBC 0x0000000000000000
HSTMT 0x0000000008C9E210
WCHAR * 0x000000000A69BFE8
SDWORD * 0x000000000A69BFD4
WCHAR * 0x0000000000123CF0
SWORD 1024
SWORD * 0x0000000000124104
MyApp 4e0-1680 EXIT SQLErrorW with return code 0 (SQL_SUCCESS)
HENV 0x0000000000000000
HDBC 0x0000000000000000
HSTMT 0x0000000008C9E210
WCHAR * 0x000000000A69BFE8 [ 5] "01004"
SDWORD * 0x000000000A69BFD4 (0)
WCHAR * 0x0000000000123CF0 [ 36] "[ODBC Firebird Driver]Data truncated"
SWORD 1024
SWORD * 0x0000000000124104 (36)
MyApp 4e0-1680 ENTER SQLRowCount
HSTMT 0x0000000008C9E210
SQLLEN * 0x0000000000123218
MyApp 4e0-1680 EXIT SQLRowCount with return code 0 (SQL_SUCCESS)
HSTMT 0x0000000008C9E210
SQLLEN * 0x0000000000123218 (-1)
MyApp 4e0-1680 ENTER SQLNumResultCols
HSTMT 0x0000000008C9E210
SWORD * 0x00000000001231F4
MyApp 4e0-1680 EXIT SQLNumResultCols with return code 0 (SQL_SUCCESS)
HSTMT 0x0000000008C9E210
SWORD * 0x00000000001231F4 (1)
MyApp 4e0-1680 ENTER SQLNumParams
HSTMT 0x0000000008C9E210
SWORD * 0x00000000001231F4
MyApp 4e0-1680 EXIT SQLNumParams with return code 0 (SQL_SUCCESS)
HSTMT 0x0000000008C9E210
SWORD * 0x00000000001231F4 (2)
有什么我可以为你提供帮助的吗