rc == SQL_SUCCESS_WITH_INFO)
{
SQLTransact(henv,hdbc,SQL_COMMIT);
SQLFreeStmt(hstmt,SQL_DROP) ;
hstmt=NULL ;
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 ;
}
}
/*更新表的指定纪录*/
BOOL CWdcDatabase::UpdateRecord()
{
unsigned char szSQLSTATE[6] ;
SDWORD nErr ;
unsigned char msg[MAX_ERROR_MSG + 1] ;
SWORD cbmsg ;
RETCODE rc ;
CString sTemp ;
if(!m_bOpen)
return FALSE ;
m_sQuery.Format("Update %s Set ",m_sTable) ;
int ff = 0 ;
for(int f= 0 ;f<m_nFields ;f++)
{
if (ff>0)
m_sQuery += "," ;
ff ++ ;
if(m_sFieldValue[f]!="") /*数据为空*/
{
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])) ;
}
else
sTemp.Format("%s=%s",m_sFieldName[f],NULL) ;
m_sQuery += sTemp ;
}
m_sQuery += " Where " ;
ff = 0 ;
for(f=0 ;f<m_nFields ;f++)
{
if(m_bKeyField[f]) /*如果为主键*/
{
if(ff>0)
m_sQuery += "," ;
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 ;
}
}
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 (北联网教程,专业提供视频软件下载)
……