[摘要]rc == SQL_SUCCESS_WITH_INFO) SQLTransact(henv,hdbc,SQL_COMMIT); SQLFreeStmt(hstmt,SQL_D...
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 ;
}
}
/*带入条件为 Where 以后的条件*/
BOOL CWdcDatabase::DeleteRecord(CString &sWhereDelete)
{
RETCODE rc ;
unsigned char szSQLSTATE[6] ;
SDWORD nErr ;
unsigned char msg[MAX_ERROR_MSG+1] ;
SWORD cbmsg ;
CString sTemp ;
if(!m_bOpen)
return FALSE ;
m_sQuery = "" ;
m_sErrMsg = "" ;
/*开始构造删除语句*/
m_sQuery.Format("Delete From %s ",m_sTable) ;
/* int ff =0 ;
for(int f= 0 ;f<m_nFields;f++)
{
if(m_bKeyField[f]) /*如果是表的主键
{
if(ff>0) /*如果主键超过2个,要把条件连接起来
m_sQuery += " AND " ;
ff++ ;
if (m_bNumeric[f])
sTemp.Format("%s=%s",m_sFieldName[f],m_sFieldValue[f]) ;
else
sTemp.Format("%s=%s",m_sFieldName[f],Quote(m_sFieldValue[f])) ;
m_sQuery += sTemp ;
}
}
*/
if(sWhereDelete !="")
m_sQuery +=" Where " + sWhereDelete ;
TRACE0(m_sQuery) ;
memset((char*)szQuery,0x00,sizeof(szQuery)) ;
strcpy((char*)szQuery,m_sQuery) ;
SQLAllocStmt(hdbc,&hstmt) ;
rc = SQLExecDirect(hstmt,
szQuery,
SQL_NTS) ;
m_nError = (int) rc ;
if(rc ==SQL_SUCCESS (北联网教程,专业提供视频软件下载)
……