Click here to Skip to main content
14,326,871 members
Rate this:
Please Sign up or sign in to vote.
See more:
DataSet ds= new DataSet();
            DataTable dt2 = new DataTable();
            System.Data.SqlClient.SqlCommandBuilder cb;
            cb = new System.Data.SqlClient.SqlCommandBuilder(tableView);
            DataRow dRow = dset.Tables["Info"].NewRow();
            dRow[0] = txt_Fname.Text;
            dRow[1] = txt_Lname.Text;
            dRow[2] = txt_Address.Text;
            dRow[3] = Date_picker.Text;
            dset.Tables["Info"].Rows.Add(dRow);
            tableView.Update(dset, "Info");
            tableView.UpdateCommand = cb.GetUpdateCommand();
            tableView.Fill(dt2);
            tableView.AcceptChangesDuringUpdate = true;




the value is in dataset it is not getting updated in table.even after giving update.
I am using express edition. can any one help in solving this

thanks,.
Posted
Updated 18-Apr-12 23:51pm
v2
Comments
Mantu Singh 19-Apr-12 5:59am
   
Did you get any exception or error like Dynamic generation of Sql Command is not supported when query does not have key column information IS tableView a DataAdapter?
Rate this:
Please Sign up or sign in to vote.

Solution 1

From the following statements of the question
tableView.Update(dset, "Info");
tableView.UpdateCommand = cb.GetUpdateCommand();

It can be seen that UpdateCommand is assigned after calling the Update method.
Just check whether there is any problem due to this.
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

Can you please have a look at this link given below:

http://msdn.microsoft.com/en-us/library/33y2221y(v=vs.100).aspx[^]
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100