开发者

SQL Statement Not failing, but not inserting

开发者 https://www.devze.com 2022-12-18 06:40 出处:网络
ASP.NET 2.0, SQL 2005. I have a very basic insert statement. I ente开发者_C百科r all the data into the app and step through. No errors are rasied in the app or the stored proc. Yet, when I go to check

ASP.NET 2.0, SQL 2005. I have a very basic insert statement. I ente开发者_C百科r all the data into the app and step through. No errors are rasied in the app or the stored proc. Yet, when I go to check out the table, no record was inserted. Is there some sort of quirk or bug in SQL server I am unaware of? I have tried ExecuteScalar & ExecuteNonQuery.


Can it be that you open a transaction and never Commit one? Remember that

using(var transaction = connection.BeginTransaction())
{
    // Code
}

does not commit it, but rather rolls back the whole thing. You have to explicitly invoke transaction.Commit().


You need to commit your transaction.


I had (have) this problem on a website of mine written in PHP. If you are trying to insert a string are you sure you have escaped all necessary characters? Using a single quote in something like don't, won't, or aren't needs to be escaped!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号