Use of unassigned local variable trying to pass a sql statment through a var.
-
On Button Press, I am updating my userfeedback table certain columns, depending on who they are.
private void Button1_Click(object sender, System.EventArgs e) { bool bNoError =true; OleDbConnection con = new OleDbConnection(strConnection2); string strSQL; DataSet ds = new DataSet(); CUsers user =new CUsers(); user=(CUsers)Session["SessionUser"]; switch(user.Role) { case "TL": //string strStatus=""; if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [TLComment]='"+TLComment.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"', [NeedAction]='"+NeedAction.Checked+"' WHERE autoNum="+autoNum.Text; break; case "CP": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [CPComment]='"+CPComment.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+autoNum.Text; break; case "ORA": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [ORAComments]='"+ORAComments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+autoNum.Text; break; case "DMO": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [DMComments]='"+DMComments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+autoNum.Text; break; case "User": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [Comments]='"+Comments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+autoNum.Text; break; } try { OleDbDataAdapter da = new OleDbDataAdapter(strSQL,strConnection2); da.Fill(ds); DataTable mytable =ds.Tables[0]; DataRow myRow ; myRow = mytable.Rows[0];
-
On Button Press, I am updating my userfeedback table certain columns, depending on who they are.
private void Button1_Click(object sender, System.EventArgs e) { bool bNoError =true; OleDbConnection con = new OleDbConnection(strConnection2); string strSQL; DataSet ds = new DataSet(); CUsers user =new CUsers(); user=(CUsers)Session["SessionUser"]; switch(user.Role) { case "TL": //string strStatus=""; if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [TLComment]='"+TLComment.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"', [NeedAction]='"+NeedAction.Checked+"' WHERE autoNum="+autoNum.Text; break; case "CP": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [CPComment]='"+CPComment.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+autoNum.Text; break; case "ORA": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [ORAComments]='"+ORAComments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+autoNum.Text; break; case "DMO": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [DMComments]='"+DMComments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+autoNum.Text; break; case "User": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [Comments]='"+Comments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+autoNum.Text; break; } try { OleDbDataAdapter da = new OleDbDataAdapter(strSQL,strConnection2); da.Fill(ds); DataTable mytable =ds.Tables[0]; DataRow myRow ; myRow = mytable.Rows[0];
string strSQL; maybe make it string strSQL = string.Empty; :confused:
-
string strSQL; maybe make it string strSQL = string.Empty; :confused:
Bloops, forgot to post, I got it right after I posted here... Yes the answer was needing to make the string empty, I did so by string strSQL=""; Actualy, onto the next step of debugging, and almost certain this is my last debug error Update of the code:
private void Button1_Click(object sender, System.EventArgs e) { bool bNoError =true; OleDbConnection con = new OleDbConnection(strConnection2); string strSQL=""; DataSet ds = new DataSet(); CUsers user =new CUsers(); user=(CUsers)Session["SessionUser"]; switch(user.Role) { case "TL": //string strStatus=""; if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [TLComment]='"+TLComment.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"', [NeedAction]='"+NeedAction.Checked+"' WHERE autoNum="+TicketNum.Text; break; case "CP": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [CPComment]='"+CPComment.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text; break; case "ORA": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [ORAComments]='"+ORAComments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text; break; case "DMO": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [DMComments]='"+DMComments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text; break; case "User": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [Comments]='"+Comments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text; break; } try { O
-
Bloops, forgot to post, I got it right after I posted here... Yes the answer was needing to make the string empty, I did so by string strSQL=""; Actualy, onto the next step of debugging, and almost certain this is my last debug error Update of the code:
private void Button1_Click(object sender, System.EventArgs e) { bool bNoError =true; OleDbConnection con = new OleDbConnection(strConnection2); string strSQL=""; DataSet ds = new DataSet(); CUsers user =new CUsers(); user=(CUsers)Session["SessionUser"]; switch(user.Role) { case "TL": //string strStatus=""; if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [TLComment]='"+TLComment.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"', [NeedAction]='"+NeedAction.Checked+"' WHERE autoNum="+TicketNum.Text; break; case "CP": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [CPComment]='"+CPComment.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text; break; case "ORA": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [ORAComments]='"+ORAComments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text; break; case "DMO": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [DMComments]='"+DMComments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text; break; case "User": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [Comments]='"+Comments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text; break; } try { O
Why do people insist on catching errors they don't know how to handle then throw away useful information! I would suspect that you shouldn't be getting a data type mismatch error at all, so why are you catching it here... Oh... I see because it it the button click event handler... Why do you have database code in the presentation layer?! You'll be glad you don't work for the company I work for. It is written into out coding standards documentation that the use of data access code in a windows or web form is a sackable offence. First, comment out the catch block. Find out exacly what is causing the exception and fix it.
Upcoming events: * Glasgow: 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
-
Why do people insist on catching errors they don't know how to handle then throw away useful information! I would suspect that you shouldn't be getting a data type mismatch error at all, so why are you catching it here... Oh... I see because it it the button click event handler... Why do you have database code in the presentation layer?! You'll be glad you don't work for the company I work for. It is written into out coding standards documentation that the use of data access code in a windows or web form is a sackable offence. First, comment out the catch block. Find out exacly what is causing the exception and fix it.
Upcoming events: * Glasgow: 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
This was surely not production code ? The giveaway is that the button is called Button1....
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
On Button Press, I am updating my userfeedback table certain columns, depending on who they are.
private void Button1_Click(object sender, System.EventArgs e) { bool bNoError =true; OleDbConnection con = new OleDbConnection(strConnection2); string strSQL; DataSet ds = new DataSet(); CUsers user =new CUsers(); user=(CUsers)Session["SessionUser"]; switch(user.Role) { case "TL": //string strStatus=""; if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [TLComment]='"+TLComment.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"', [NeedAction]='"+NeedAction.Checked+"' WHERE autoNum="+autoNum.Text; break; case "CP": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [CPComment]='"+CPComment.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+autoNum.Text; break; case "ORA": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [ORAComments]='"+ORAComments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+autoNum.Text; break; case "DMO": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [DMComments]='"+DMComments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+autoNum.Text; break; case "User": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [Comments]='"+Comments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+autoNum.Text; break; } try { OleDbDataAdapter da = new OleDbDataAdapter(strSQL,strConnection2); da.Fill(ds); DataTable mytable =ds.Tables[0]; DataRow myRow ; myRow = mytable.Rows[0];
1 - all your code is ripe for SQL injection attacks 2 - As has been said, you should never have DB code in your presentation layer 3 - As has been said, why catch exceptions and do nothing ? 4 - use string.Empty over "", as it's more efficient 5 - Give your controls meaningful names. When someone else looks at the code, how do they know which button was button1 ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
1 - all your code is ripe for SQL injection attacks 2 - As has been said, you should never have DB code in your presentation layer 3 - As has been said, why catch exceptions and do nothing ? 4 - use string.Empty over "", as it's more efficient 5 - Give your controls meaningful names. When someone else looks at the code, how do they know which button was button1 ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
Christian Graus wrote:
4 - use string.Empty over "", as it's more efficient
Even better: assign null to the reference. That way if you try to use the value without assigning it a usable value, you will get a null reference exception instead of a cryptic error from the database. Alternatively, add a default case in the switch, where you throw an appropriate exception. That way you don't have to assign anything to the variable before the switch statement, as the compiler knows that the variable always has a value when you exit the switch.
--- single minded; short sighted; long gone;
-
1 - all your code is ripe for SQL injection attacks 2 - As has been said, you should never have DB code in your presentation layer 3 - As has been said, why catch exceptions and do nothing ? 4 - use string.Empty over "", as it's more efficient 5 - Give your controls meaningful names. When someone else looks at the code, how do they know which button was button1 ?
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
1. People have said this, but I still don't understand what they mean. 2. Why should you never have DB code in your presentation layer? 3. Actually, that is my most recent problem, the exception is catching an error, every value is updating the table, yet the exception err, is throwing "cannot find table 0" 4. I didn't even know you could do that, you would think the people that I work with that have degree's would code the write way, I guess not! 5. Eh, button1, I normaly do, this page actually only has one button it. I just hadn't gotten to renameing it. Here is the most recent of my button1click,
private void Button1_Click(object sender, System.EventArgs e) { bool bNoError =true; OleDbConnection con = new OleDbConnection(strConnection2); string strSQL=""; DataSet ds = new DataSet(); CUsers user =new CUsers(); user=(CUsers)Session["SessionUser"]; switch(user.Role) { case "TL": //string strStatus=""; if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } else { TicketClosedBy.Text=""; } strSQL="UPDATE UserFeedback set [TLComment]='"+TLComment.Text+"', [TLwho]='"+TLwho.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"', [NeedAction]='"+NeedAction.SelectedValue+"' WHERE autoNum="+TicketNum.Text; break; case "CP": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [CPComment]='"+CPComment.Text+"', [CPwho]='"+CPwho.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text; break; case "ORA": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [ORAComments]='"+ORAComments.Text+"', [ORAwho]='"+ORAwho.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text; break; case "DMO": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [DMComments]='"+DMComments.Text+"', [DMwho]='"+DMwho.T
-
This was surely not production code ? The giveaway is that the button is called Button1....
Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
It wont be "production" for another 6 months. Again, though I bulid data collection websites for the govt. I have trained users, and on a secure server, that only my users have access too. The actual website, will be used for about 2 months, and then, never used again, and I will start another project.
-
1. People have said this, but I still don't understand what they mean. 2. Why should you never have DB code in your presentation layer? 3. Actually, that is my most recent problem, the exception is catching an error, every value is updating the table, yet the exception err, is throwing "cannot find table 0" 4. I didn't even know you could do that, you would think the people that I work with that have degree's would code the write way, I guess not! 5. Eh, button1, I normaly do, this page actually only has one button it. I just hadn't gotten to renameing it. Here is the most recent of my button1click,
private void Button1_Click(object sender, System.EventArgs e) { bool bNoError =true; OleDbConnection con = new OleDbConnection(strConnection2); string strSQL=""; DataSet ds = new DataSet(); CUsers user =new CUsers(); user=(CUsers)Session["SessionUser"]; switch(user.Role) { case "TL": //string strStatus=""; if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } else { TicketClosedBy.Text=""; } strSQL="UPDATE UserFeedback set [TLComment]='"+TLComment.Text+"', [TLwho]='"+TLwho.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"', [NeedAction]='"+NeedAction.SelectedValue+"' WHERE autoNum="+TicketNum.Text; break; case "CP": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [CPComment]='"+CPComment.Text+"', [CPwho]='"+CPwho.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text; break; case "ORA": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [ORAComments]='"+ORAComments.Text+"', [ORAwho]='"+ORAwho.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text; break; case "DMO": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [DMComments]='"+DMComments.Text+"', [DMwho]='"+DMwho.T
Cannot find table 0. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IndexOutOfRangeException: Cannot find table 0. Source Error: Line 440: Line 441: da.Fill(ds); Line 442: DataTable mytable =ds.Tables[0]; Line 443: DataRow myRow ; Line 444: myRow = mytable.Rows[0]; Source File: c:\dimhrs\helpdesk\userfeedback.aspx.cs Line: 442 Stack Trace: [IndexOutOfRangeException: Cannot find table 0.] System.Data.DataTableCollection.get_Item(Int32 index) DIMHRS.HelpDesk.UserFeedBack.Button1_Click(Object sender, EventArgs e) in c:\dimhrs\helpdesk\userfeedback.aspx.cs:442 System.Web.UI.WebControls.Button.OnClick(EventArgs e) System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) System.Web.UI.Page.ProcessRequestMain()
-
Cannot find table 0. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.IndexOutOfRangeException: Cannot find table 0. Source Error: Line 440: Line 441: da.Fill(ds); Line 442: DataTable mytable =ds.Tables[0]; Line 443: DataRow myRow ; Line 444: myRow = mytable.Rows[0]; Source File: c:\dimhrs\helpdesk\userfeedback.aspx.cs Line: 442 Stack Trace: [IndexOutOfRangeException: Cannot find table 0.] System.Data.DataTableCollection.get_Item(Int32 index) DIMHRS.HelpDesk.UserFeedBack.Button1_Click(Object sender, EventArgs e) in c:\dimhrs\helpdesk\userfeedback.aspx.cs:442 System.Web.UI.WebControls.Button.OnClick(EventArgs e) System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) System.Web.UI.Page.ProcessRequestMain()
I rewrote the try, and also put in something to catch the Handle the Error.
private void UpdateFeedback_Click(object sender, System.EventArgs e) { bool bNoError =true; OleDbConnection con = new OleDbConnection(strConnection2); string strSQL=""; DataSet ds = new DataSet(); CUsers user =new CUsers(); user=(CUsers)Session["SessionUser"]; switch(user.Role) { case "TL": //string strStatus=""; if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } else { TicketClosedBy.Text=""; } strSQL="UPDATE UserFeedback set [TLComment]='"+TLComment.Text+"', [TLwho]='"+TLwho.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"', [NeedAction]='"+NeedAction.SelectedValue+"' WHERE autoNum="+TicketNum.Text; break; case "CP": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [CPComment]='"+CPComment.Text+"', [CPwho]='"+CPwho.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text; break; case "ORA": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [ORAComments]='"+ORAComments.Text+"', [ORAwho]='"+ORAwho.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text; break; case "DMO": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [DMComments]='"+DMComments.Text+"', [DMwho]='"+DMwho.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text; break; case "User": if(TicketStatus.SelectedValue=="Closed") { string strStatus="Closed"; TicketClosedBy.Text = strStatus; } strSQL="UPDATE UserFeedback set [Comments]='"+Comments.Text+"', [TicketStatus]='"+TicketStatus.SelectedValue+"', [TicketClosedBy]='"+TicketClosedBy.Text+"' WHERE autoNum="+TicketNum.Text; break; } try { OleD