Hi, I meet a problem in use c/c++ API to update a row in table. all return value means the operate is successful, But the row have no change at all. and the INSERT , SELECT operation is OK.
I think maybe I'm not first one meet this problem.But I can't visit the archive. So if anyone here know about this problem,please help me. the main code al follow: wstring sql = L"UPDATE Mail SET [Content] = ?1 [CurrentSize] = ?2 WHERE [MailID] = ?3;"; sqlite3_stmt *pstmt = NULL; const char *pzTail = 0; int nRes = SQLITE_OK; nRes = sqlite3_prepare16_v2((sqlite3*)pDB, (void**)sql.c_str(), sizeof(wchar_t) * sql.length(), &pstmt, 0); if (0 != nRes) { return -1; } do { int len = 0; void* pdata = NULL; //Content pdata = (void*)pMail->m_content.c_str(); len = sizeof(wchar_t) * pMail->m_content.length(); if( SQLITE_OK != (nRes = sqlite3_bind_text16(pstmt, 1, pdata, len, SQLITE_TRANSIENT)) )break; //CurrentSize if( SQLITE_OK != (nRes = sqlite3_bind_int(pstmt, 2, pMail->m_curSize)) )break; if( SQLITE_OK != (nRes = sqlite3_bind_int(pstmt, 3, pMail->GetID())) )break; if ( SQLITE_DONE != (nRes = sqlite3_step(pstmt)) ) break; }while (0); sqlite3_finalize(pstmt); if(SQLITE_OK != nRes && SQLITE_DONE != nRes) { return -1; } else { return 0; } -- -- Thanks! 王志刚 --------------------------- 电话:021-62672000-2852 上海圣诺网络技术有限公司 --------------------------- _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users