In this article i have shown to display value in to database using c# using gridview
try
{
con.Open();
string query = "select * from feesentry_tb";
SqlCommand cmd = new SqlCommand(query, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
grdvw.DataSource = dt;
grdvw.DataBind();
}
catch (Exception ex)
{
Response.Write(ex);
}
finally
{
con.Close();
}
try
{
con.Open();
string query = "select * from feesentry_tb";
SqlCommand cmd = new SqlCommand(query, con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
grdvw.DataSource = dt;
grdvw.DataBind();
}
catch (Exception ex)
{
Response.Write(ex);
}
finally
{
con.Close();
}
0 comments: