sql server transactions
-
I'm using asp.net 2.0 and sql server 2000. I'm using a transaction to wrap the execution of 2 insert commands on the sql server together. On the development system everything works fine. On the target system it executes the 2 inserts properly but then displays the error message: Sqltransaction is finished and cannot be used anymore the stack: System.Data.SqlClient.SqlTransaction.ZombieCheck() +701167 System.Data.SqlClient.SqlTransaction.Rollback() +120 kurz.GV1_RowCommand(Object sender, GridViewCommandEventArgs e) +2901 System.Web.UI.WebControls.GridView.OnRowCommand(GridViewCommandEventArgs e) +104 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +76 System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +200 System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +170 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5612 does it try to make a rollback? but the things are inserted properly. And then it makes the funny Zombiecheck and maybe found one. Did anybody solve a similar issue? Thanks in advance. Wilfried.
-
I'm using asp.net 2.0 and sql server 2000. I'm using a transaction to wrap the execution of 2 insert commands on the sql server together. On the development system everything works fine. On the target system it executes the 2 inserts properly but then displays the error message: Sqltransaction is finished and cannot be used anymore the stack: System.Data.SqlClient.SqlTransaction.ZombieCheck() +701167 System.Data.SqlClient.SqlTransaction.Rollback() +120 kurz.GV1_RowCommand(Object sender, GridViewCommandEventArgs e) +2901 System.Web.UI.WebControls.GridView.OnRowCommand(GridViewCommandEventArgs e) +104 System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +76 System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +200 System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7 System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11 System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +170 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5612 does it try to make a rollback? but the things are inserted properly. And then it makes the funny Zombiecheck and maybe found one. Did anybody solve a similar issue? Thanks in advance. Wilfried.
It will be much more helpful if you can post some sample code of transaction what you wrote and the data you inserted.. :cool:
printf("Navaneeth!!") www.w3hearts.com
-
It will be much more helpful if you can post some sample code of transaction what you wrote and the data you inserted.. :cool:
printf("Navaneeth!!") www.w3hearts.com
ok thats the code: I execute it in the gridview_RowCommand() and on the development system everything is great. sqlKont = "Update tbnKontBib set fest=fest+ CONVERT( money," & "'" & Komma2Punkt(diffFest) & "') " & _ "where bh='" & Session("bHalle") & "'" sql = "Insert into tbOrder(artnr, odatum, bh, oanz, opreis, bhoper) Values( " & _ "'" & artnum & "'" & "," & _ "'" & Date.Now.ToShortDateString & "'" & "," & _ "'" & Session("bHalle") & "'" & "," & _ "'" & anzBest & "'" & "," & _ "CONVERT( money," & "'" & Komma2Punkt(preis) & "')" & "," & _ "'" & Session("bUser") & "')" 'Ausfuehrung mit Transaction Try t = conn.BeginTransaction cmd = New SqlCommand(sqlKont, conn) cmd.Transaction = t erg = cmd.ExecuteNonQuery() If erg <> 1 Then 'Fehler MsgBox("K-Fehler in Bestellung! Bitte Administrator benachrichtigen!", MsgBoxStyle.Critical, "!!! Achtung !!!") t.Rollback() GoTo ende End If cmd = New SqlCommand(sql, conn) cmd.Transaction = t erg = cmd.ExecuteNonQuery() If erg <> 1 Then 'Fehler MsgBox("O-Fehler in Bestellung! Bitte Administrator benachrichtigen!", MsgBoxStyle.Critical, "!!! Achtung !!!") t.Rollback() GoTo ende End If t.Commit() MsgBox("Ihre Bestellung wurde ausgeführt!", MsgBoxStyle.Exclamation, "Bestellvorgang") Catch ex As Exception t.Rollback() MsgBox("Ihre Bestellung ist fehlgeschlagen! Bitte wiederholen sie die Bestellung.", MsgBoxStyle.Critical, "Bestellvorgang") End Try ende: conn.Close() Bye Wilfried
-
ok thats the code: I execute it in the gridview_RowCommand() and on the development system everything is great. sqlKont = "Update tbnKontBib set fest=fest+ CONVERT( money," & "'" & Komma2Punkt(diffFest) & "') " & _ "where bh='" & Session("bHalle") & "'" sql = "Insert into tbOrder(artnr, odatum, bh, oanz, opreis, bhoper) Values( " & _ "'" & artnum & "'" & "," & _ "'" & Date.Now.ToShortDateString & "'" & "," & _ "'" & Session("bHalle") & "'" & "," & _ "'" & anzBest & "'" & "," & _ "CONVERT( money," & "'" & Komma2Punkt(preis) & "')" & "," & _ "'" & Session("bUser") & "')" 'Ausfuehrung mit Transaction Try t = conn.BeginTransaction cmd = New SqlCommand(sqlKont, conn) cmd.Transaction = t erg = cmd.ExecuteNonQuery() If erg <> 1 Then 'Fehler MsgBox("K-Fehler in Bestellung! Bitte Administrator benachrichtigen!", MsgBoxStyle.Critical, "!!! Achtung !!!") t.Rollback() GoTo ende End If cmd = New SqlCommand(sql, conn) cmd.Transaction = t erg = cmd.ExecuteNonQuery() If erg <> 1 Then 'Fehler MsgBox("O-Fehler in Bestellung! Bitte Administrator benachrichtigen!", MsgBoxStyle.Critical, "!!! Achtung !!!") t.Rollback() GoTo ende End If t.Commit() MsgBox("Ihre Bestellung wurde ausgeführt!", MsgBoxStyle.Exclamation, "Bestellvorgang") Catch ex As Exception t.Rollback() MsgBox("Ihre Bestellung ist fehlgeschlagen! Bitte wiederholen sie die Bestellung.", MsgBoxStyle.Critical, "Bestellvorgang") End Try ende: conn.Close() Bye Wilfried
Your code is susceptable to a SQL Injection attack: See SQL Injection Attacks and Tips on How to Prevent Them[^]
Upcoming events: * Glasgow: Introduction to AJAX (2nd May), SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website
-
Your code is susceptable to a SQL Injection attack: See SQL Injection Attacks and Tips on How to Prevent Them[^]
Upcoming events: * Glasgow: Introduction to AJAX (2nd May), SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website
-
Ok I'll use parameters later, but if you could give me a hint to my problem it would be a great help. Thanks Wilfried.