rc == SQL_SUCCESS_WITH_INFO)
{
SQLTransact(henv,hdbc,SQL_COMMIT);
SQLFreeStmt(hstmt,SQL_DROP) ;
return TRUE ;
}
else
{
m_sErrMsg = "" ;
while(SQLError(0,
0,
hstmt,
szSQLSTATE,
&nErr,
msg,
sizeof(msg) ,
&cbmsg ) == SQL_SUCCESS )
m_sErrMsg += "\t\t" +(CString) msg + "\n" ;
SQLFreeStmt(hstmt,SQL_DROP) ;
return FALSE ;
}
}
/* 查找纪录---
返回值
1: 即没有错误发生的找到纪录
-1: 在查找过程中出现错误
0: 查找过程当中没有错误出现,但是没有找到适合条件的纪录,即没有返回纪录 */
int CWdcDatabase::SelectMatchingRecords(CString &sWhereContext)
{
unsigned char szSQLSTATE[6];
SDWORD nErr ;
unsigned char msg[MAX_ERROR_MSG+1] ;
SWORD cbmsg ;
CString sTemp ;
char szData[MAX_DATA] ;
SDWORD cbData ;
RETCODE rc ;
if(!m_bOpen)
return -1 ;
sTemp="" ;
int ff=0 ;
for(int j=0;j<m_nFields;j++)
{
if(ff>0)
sTemp += "," ;
ff ++ ;
sTemp += m_sFieldName[j] ;
}
if(sWhereContext == "")
m_sQuery.Format("Select %s from %s",sTemp,m_sTable) ;
else
m_sQuery.Format("Select %s From %s Where %s",sTemp,m_sTable,sWhereContext) ;
SQLAllocStmt(hdbc,&hstmt_select) ;
memset((char*)szQuery,0x00,sizeof(szQuery)) ;
strcpy((char*)szQuery,m_sQuery) ;
rc = SQLExecDirect(hstmt_select,
szQuery,
SQL_NTS) ;
m_nError = (int) rc ;
if(rc == SQL_SUCCESS (北联网教程,专业提供视频软件下载)
……