我有SQL數據庫的每一件事工作的權利需要正確的SQL語句
NSString *insertSQL = [NSString stringWithFormat: @"INSERT INTO CONTACTS where (modifiedAdress) VALUES (\"%@\")", hemaInsert];
我用這個插入我多麼但條件
只有我需要的SQL語句,上述嵌件接觸柱modifiedAdress價值hemainsert (condition hemaInsert = ID)
NSString *insertSQL = [NSString stringWithFormat: @"INSERT INTO CONTACTS where (modifiedAdress) VALUES (\"%@\")", hemaInsert];
這是一個非常不好的做法是使用字符串格式創建的SQL語句。如果替換值具有某些字符,則會發生不好的事情。這可能會導致查詢失敗。這也是許多SQL注入攻擊的基礎。查看iPatel的答案,將正確的方法綁定到準備好的語句中。 – rmaddy 2013-03-02 17:07:56