0
餘米試圖存儲在數據庫中的兩個值,但我m到處語法錯誤 這裏我的代碼在sqlite3中獲取語法錯誤?
- (IBAction)LogIn:(id)sender {
sqlite3 *dbConnection;
sqlite3_stmt *statement = Nil;
if (sqlite3_open([[sharedobj getSandboxPath] UTF8String], &dbConnection) == SQLITE_OK) {
NSString *insertQuery = [NSString stringWithFormat:@"INSERT INTO LOGINVALUES ('%@','%@')",self.userNameField.text,self.passwordField.text];
if (sqlite3_prepare_v2(dbConnection, [insertQuery UTF8String], -1, &statement, NULL) == SQLITE_OK) {
sqlite3_bind_text(statement, 1, [self.userNameField.text UTF8String], -1, NULL);
sqlite3_bind_text(statement, 2, [self.passwordField.text UTF8String], -1, NULL);
}
if (sqlite3_step(statement) == SQLITE_DONE) {
NSLog(@"successfully inserted a record in table");
}
else{
NSLog(@"error is %s",sqlite3_errmsg(dbConnection));
}
}
sqlite3_finalize(statement);
sqlite3_close(dbConnection);
} 但我m到處
error is near ")": syntax error
如何解決這個問題? 在此先感謝。
其作品感謝拉爾託 – user3585325 2014-09-01 10:39:14