private void Populatebooks()
{
string Populatebooks = "GetUserPOSTS";
using (SqlConnection con = new SqlConnection(constring4))
{
con.Open();
using (SqlCommand cmd = new SqlCommand(Populatebooks, con))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@UserName", Session["userName"]);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
sda.Fill(dt);
ViewState["DataTable"] = dt;
this.Populatebooks2(dt);
string username5 = this.Page.User.Identity.Name;
}
}
}
private void Populatebooks2(DataTable dt)
{
string Populatebooks = "GetUserPOSTS";
using (SqlConnection con = new SqlConnection(constring4))
{
con.Open();
using (SqlCommand cmd = new SqlCommand(Populatebooks, con))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@UserName", Session["userName"]);
SqlDataAdapter sdaa = new SqlDataAdapter(cmd);
DataTable dt2 = new DataTable();
sdaa.Fill(dt2);
GetMergedAll.DataSource = dt2;
GetMergedAll.DataBind();
//merging first data table into second data table
dt2.Merge(dt);
dt2.AcceptChanges();
GridView3.DataSource = dt2;
GridView3.DataBind();
}
}
}