NOT ABLE TO STORE DATA IN DATABASE

ashwini dharamsale

Total Post:1

Points:7
Posted by  ashwini dharamsale
 2845  View(s)
Ratings:
Rate this:
protected void InsertNewRecord(object sender, EventArgs e)
    {
      
        try
        {
            string strName = GlobalClass.dt.Rows[0]["TechnisionName"].ToString();
            if (strName == "0")
            {
                GlobalClass.dt.Rows[0].Delete();
                GlobalClass.adap.Update(GlobalClass.dt);
            }
            TextBox txtDate = GridView1.FooterRow.FindControl("txtNewDate") as TextBox;
            TextBox txtName = GridView1.FooterRow.FindControl("txtNewName") as TextBox;
            TextBox txtTask = GridView1.FooterRow.FindControl("txtNewTask") as TextBox;
            TextBox txtStatus = GridView1.FooterRow.FindControl("txtNewStatus") as TextBox;
            TextBox txtRemark = GridView1.FooterRow.FindControl("txtNewRemark") as TextBox;
            DataRow dr = GlobalClass.dt.NewRow();
            dr["Date"] = txtDate.Text.Trim();
            dr["TechnisionName"] = txtName.Text.Trim();
            dr["Task"] = txtTask.Text.Trim();
            dr["Status"] = txtStatus.Text.Trim();
            dr["Remark"] = txtRemark.Text.Trim();
            GlobalClass.dt.Rows.Add(dr);
            GlobalClass.adap.Update(GlobalClass.dt);
            GridView1.ShowFooter = false;
            FillGridView();
            }
        catch
        {
             Response.Write("<script> alert('Record not added...') </script>");
        }
    }

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!