Update Query not working C# asp.net

Aftemerassamn

New Member
In this page only this query\[code\]c1.cmd.CommandText = "update mechprofile set mech_status ='busy' where mech_regid ='" + alotmech + "'";\[/code\]is working, rest of the queries are not working... Please help me out, its urgent...Hope to get a working solution asap. Thanks\[code\]public partial class customercare_alotmechanic : System.Web.UI.Page{ Class1 c = new Class1(); Class1 c1 = new Class1(); int sno; string license; string status; string alotmech; string mechregid; string mrg; protected void Page_Load(object sender, EventArgs e) { try { sno = Convert.ToInt32((Request.Form["sno"])); status = Request.Form["sta"]; alotmech = Request.Form["Sel"]; mrg = Request.Form["mechregid"]; if (alotmech.Equals("Alloted")) { c.con.Open(); c.cmd.CommandText = "update probprofile set Status = 'done' where Sno ='" + sno + "'"; c.cmd.ExecuteNonQuery(); c.con.Close(); c.con.Open(); c.cmd.CommandText = "update mechprofile set mech_status = 'free' where mech_regid ='" + mrg + "'"; c.cmd.ExecuteNonQuery(); c.con.Close(); } else { c.con.Open(); c.cmd.CommandText = "update probprofile set mechregid = '" + alotmech + "' where Sno ='" + sno + "'"; c.cmd.ExecuteNonQuery(); c.con.Close(); c1.con.Open(); c1.cmd.CommandText = "update mechprofile set mech_status ='busy' where mech_regid ='" + alotmech + "'"; c1.cmd.ExecuteNonQuery(); c1.con.Close(); } } finally { string strScript = "<script>"; strScript += "alert('ALOT MECHANIC PAGE..');"; strScript += "window.location='problemstatus.aspx';"; strScript += "</script>"; Page.RegisterClientScriptBlock("strScript", strScript); } }}\[/code\]In the above code update commands are not working... please help me out... i have a form on a page with method=post and action se to this page on which update query runs.
 
Back
Top