none
Update the Sql Express Table using Dataset RRS feed

  • General discussion

  • con = new SqlConnection(constr);
            string sqlstr = "select * from eBasic";
            SqlCommand cmd = new SqlCommand(sqlstr, con);

            SqlDataAdapter adp = new SqlDataAdapter(cmd);
            DataSet ds = new DataSet();
            adp.Fill(ds, "eBasic");
           
            DataRow dr=ds.Tables["eBasic"].NewRow();
            dr["Eid"] = Convert.ToInt16(TextBox1.Text);
            dr[1] = TextBox2.Text;
            dr[2] = TextBox3.Text;
            dr[3] = Convert.ToInt16(TextBox4.Text);

            ds.Tables["eBasic"].Rows.Add(dr);
            SqlCommandBuilder cb = new SqlCommandBuilder(adp);
           
            adp.Update(ds, "eBasic");
           
            Response.Write("Insertetd");

     


    This code updates table using DATASET .

    Saturday, July 7, 2007 3:20 AM