Click here to Skip to main content
15,884,836 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
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?

From the following statements of the question
C#
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.
 
Share this answer
 
Can you please have a look at this link given below:

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

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900