micky singh

micky singh

  • NA
  • 1
  • 4.2k

how to delete and update record in database using dataadapter in visual c#

Jul 23 2010 5:04 PM
can you tell me that how to delete or update data using dataadapter in visual c#

i am giving you the code:

the delete module:


            SqlCommandBuilder cb;
            cb = new SqlCommandBuilder(da);
           
            dset.Tables["micky"].Rows[inc].Delete();
            MaxRow--;
            inc = 0;
            display();
            da.Update(dset, "micky");
            MessageBox.Show("record deleted");
            con.Close();



the update module:


            SqlCommandBuilder cb;
            cb = new SqlCommandBuilder(da);
            DataRow drow= dset.Tables["micky"].Rows[inc];
            drow[1] = textBox1.Text;
            drow[2] = textBox2.Text;
            drow[3] = textBox3.Text;
            da.Update(dset, "micky");
            MessageBox.Show("data updated");
            con.Close();


any suggestion will be welcomed

my email id is [email protected]


Answers (1)