我開發的應用程序來更新列,其中我是存儲在數據庫的數據,無法SQLite中
雖然將數據存儲到數據庫,我無法更新DB我的列值,
這裏是我的代碼:
我通過我的更新查詢此方法:
QUERY = UPDATE Tbl SET favStatus ='0' WHERE Merchant_ID='1522' and Voucher_Id='5038'
//調用方法..
[self UpdateStatus:QUERY];
-(void)UpdateStatus:(NSString*)Query{
// Get the documents directory
databasePath=[self GetDBPath];
if(sqlite3_open([databasePath UTF8String],&contactDB)==SQLITE_OK)
{
sqlite3_stmt *compiledStmt;
if(sqlite3_prepare_v2(contactDB, [Query UTF8String],-1,&compiledStmt, NULL)==SQLITE_OK)
{
NSLog(@"Successful update");
}
sqlite3_step(compiledStmt);
sqlite3_close(contactDB);
}
}
我TBL包含Col1
,Col2
,Col3
,Col4
,favStatus
,Col6
6列,我想裏面favStatus
列更新值。
寫這之後,favStatus
列值沒有更新日誌顯示Successful update
即使在哪裏是我的錯?請幫忙。
感謝advnace。
也許這已經是期望值。 – Mihai
期望值爲'1'ii想要將其更改爲'0' – Krunal
您需要提交數據嗎? (在SQLite的說法「BEGIN TRANSACTION/END TRANSACTION」我認爲....) – monojohnny