在网格视图中单击更新后,代码成功运行。但是当我在另一个网页中检索数据时,我更新的列是空白的。我不知道为什么会这样。这是更新和显示的代码:这是用于更新
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string v = System.Configuration.ConfigurationManager.ConnectionStrings["harish"].ConnectionString;
con = new OracleConnection(v);
con.Open();
string query = "update leave_module1 set name='"+GridView1.Rows[e.RowIndex].Cells[0].Text+"'";
OracleCommand cmd = new OracleCommand(query, con);
cmd.ExecuteNonQuery();
ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>alert('The Data has been added');</script>;");
GridView1.EditIndex = -1;
con.Close();
}
这就是 loadgrid()
protected void loadgrid()
{
string v = System.Configuration.ConfigurationManager.ConnectionStrings["harish"].ConnectionString;
con = new OracleConnection(v);
con.Open();
cmd = new OracleCommand("select * from leave_module1 where '"+TextBox1.Text+"' between fd and td", con);
dr = cmd.ExecuteReader();
GridView1.DataSource=dr;
GridView1.DataBind();
con.Close();
dr.Close();
}