这是我要传递值的页面的代码
protected void UpdateDriver(object sender, EventArgs e)
{
Button btn = (Button)sender;
GridViewRow gvr = (GridViewRow)btn.NamingContainer;
HiddenField hid = (HiddenField)gvr.Cells[0].FindControl("hdnID");
int UserID = Convert.ToInt32(hid.Value);
String Url = "UpdateDriver.aspx?" + "UserID=" + UserID;
Response.Redirect(Url);
// BalUsers.UpdateDriver();
// HiddenField hid = (HiddenField)gridview1.Cells[0].FindControl("hdnID");
// BalUsers
}
因此,在更新驱动程序页面上,我想获取 UserID 并将其传递给我的 CommandText
protected void Button1_Click(object sender, EventArgs e)
{
myconnection.Open();
cmd.CommandText = "UPDATE [Ovms_New].[dbo].[tbl_driver] SET [lisenceNO] = ('@lisenceNO'),[liscenceType] = ('@liscenceType') WHERE (UserID = '@UserID')";
cmd.ExecuteNonQuery();
myconnection.Close();
// BalUsers.UpdateDriver(Convert.ToInt32(TextnewNo.Text), TextChangeType.Text);
}
如何获取该值并将其传递给查询谢谢提前:)