我有下面的代碼,它執行沒有任何錯誤,甚至報告1行受到影響。然而,沒有什麼是保存的。爲什麼不? 我可以儘管數據庫檢索..但不能寫什麼都沒有插入數據庫?
Dim SQLConn As New SqlConnection() 'The SQL Connection
SQLConn.ConnectionString = connstring 'Set the Connection String
SQLConn.Open()
Dim SQLCmd As New SqlCommand() 'The SQL Command
Dim SQLStr As String = "INSERT into region_table VALUES(10,23,4,'test')"
SQLCmd.CommandText = SQLStr
sqlCmd.ExecuteNonQuery()
SQLConn.Close()
SOLUTION :: 打開右鍵單擊服務器資源管理器,選擇屬性數據庫連接,並使用該連接字符串!希望這能解決別人的問題太多:d
你有和我一樣的問題嗎? http://stackoverflow.com/questions/7223223/sqlce-query-having-no-effect – Ryan 2012-01-08 18:25:21
也許你需要提交交易? – Yaniro 2012-01-08 18:25:56
你插入正確的數據庫嗎?你沒有副本在主人錯誤或任何你? – MatBailie 2012-01-08 18:31:21