任何人都可以告訴下面的代碼中出現了什麼問題嗎?OleDb使用參數值更新sql不更新Access中的記錄
command.Connection = ConnectionManager.GetConnection();
command.CommandText = "Update Table1 SET Replaceme = ? WHERE Searchme = ?";
command.CommandType = CommandType.Text;
command.Parameters.AddWithValue("Replaceme", "Goodman");
command.Parameters.AddWithValue("Searchme", "Anand");
command.Connection.Open();
int recordsaffected = command.ExecuteNonQuery();
MessageBox.Show("Records affected : " + recordsaffected);
MessageBox
顯示0條記錄,它實際上沒有更新可用的記錄。
表名(Table1)
和列名(Replaceme and Searchme)
正確拼寫。
洛爾在所有的SQL Server開發人員發佈誰不使用System.Data.OleDb –
答案是否有在Searchme柱「阿南德一排」?你在看數據庫嗎?即它是連接字符串中指定的一個。你有沒有交易,你沒有提交? –
@ ta.speot.is:嗨,先生知道這一切。給你的解決方案。 –