After I click update in the grid view, the code works successfully. But when I retrieve the data in another webpage the columns I updated are blank. I have no clue why this happens.
Here is the code for both updating and displaying:
this is for updating
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();
}
and this the 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();
}
These are the might be possible solutions or part of the whole solutions that I think would be helpful: