在这个页面中只有这个查询
c1.cmd.CommandText = "update mechprofile set mech_status ='busy' where mech_regid ='" + alotmech + "'";
正在工作,其余查询不起作用。
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);
}
}
}
在上面的代码中,更新命令不起作用...我在页面上有一个表单,其中方法=发布和操作 se 到运行更新查询的此页面。