protected void Unnamed1_Click(object sender, EventArgs e) { if (!object.Equals(Session["UserId"], null)) { string postScrap = "Insert INTO Scrap (FromId,ToId,Message) VALUES('" + Session["UserId"].ToString() + "','" + Request.QueryString["Id"].ToString() + "','" + TextBoxScrap.Text + "')"; dbClass.ConnectDataBaseToInsert(postScrap); Controls_GetUserScraps obj = new Controls_GetUserScraps(); obj.GetUserScraps(int.Parse(Request.QueryString["Id"].ToString())); }
public void GetUserScraps(int Id) { string getUserScraps = "SELECT u.Id as UserId,u.firstname,u.ImageName,s.FromId,s.ToId,s.Message,s.SendDate,s.ID as ScrapId FROM [tbl_user] as u, Scrap as s WHERE u.Id=s.FromId AND s.ToId='" + Id + "' order by senddate desc"; dt = dbClass.ConnectDataBaseReturnDT(getUserScraps); if (dt.Rows.Count > 0) { GridViewUserScraps.DataSource = dt; //this is where i am getting the exception. eventhough dt has values. GridViewUserScraps.DataBind(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)