Kamala Veni

Kamala Veni

  • NA
  • 65
  • 20k

C#,Error to getting the seven day errors

Feb 26 2016 5:02 AM
Hi
I am Having 7 Days form with Particular field including date,day,time.
am getting the data to store in sql table,database through the form.
While am Selecting 7 days using calendar  to entry the record in the form ,
its saving only the 7Th day record,1-6 day records not store in database table?
HOW TO CLEAR THE ERROR ?
 
Ex:
 
SqlConnection cnn = new SqlConnection();
cnn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["cp"].ConnectionString; cnn.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "select * from tbl_sch111";
cmd.Connection = cnn;
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
da.Fill(ds, "tbl_sch111");
SqlCommandBuilder cb = new SqlCommandBuilder(da);
DataRow drow = ds.Tables["tbl_sch111"].NewRow();
drow["Date"] = lb.Text=l.Text;
drow["Time"] = lbb.Text= l2.Text;
drow["Day"] = lbd.Text= l3.Text;
drow["blk_1"] = txtbl1.Text= TextBox1.Text;
drow["blk_2"] = txtbl2.Text= TextBox2.Text;
drow["blk_3"] = txtbl3.Text= TextBox3.Text;
drow["blk_4"] = txtbl4.Text= TextBox4.Text;
drow["blk_5"] = txtbl5.Text= TextBox5.Text;
drow["blk_6"] = txtbl6.Text= TextBox6.Text;
drow["blk_7"] = txtbl7.Text= TextBox7.Text;
drow["blk_8"] = txtbl8.Text= TextBox8.Text;
drow["blk_9"] = txtbl9.Text= TextBox9.Text;
drow["blk_10"] = txtbl10.Text= TextBox10.Text;
ds.Tables["tbl_sch111"].Rows.Add(drow);
da.Update(ds, "tbl_sch111");
 
 

Answers (2)