Dataadapter not updating datatable

Posted by / 02-Jun-2018 12:45

Dataadapter not updating datatable

This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form.For help clarifying this question so that it can be reopened, visit the help center.Row State to modified in an effort to invoke the Update. (Previous test show my SQL permissions and connection is good, I can modify the table.) connection To SQL = new Sql Connection(SQLConn String); connection To SQL.Open(); var cmd = new Sql Command("SELECT * FROM TAGS$",connection To SQL); var da = new Sql Data Adapter(cmd); var b = new Sql Command Builder(da); foreach (Data Row r in dt. Update(dt); It's difficult to tell what is being asked here.Changes are made, and a Memorize Transaction button is clicked. If the form is then closed and reopened (disposed and reloaded), the original value is shown, not the new value. If the process above is repeated, except that before closing the form the record is selected again and the Memorize Transaction button is clicked again, the value IS stored in the database.

(I could paste all the Import Excel code here but it is a lot and doesn't do anything except Fill a dt with everything in a sheet.

(the SQL table exists because of a manual import to SQL from the original Excel spreadsheet, has a primary key set.

The user updates the excel sheet and I need to update the SQL values.) I am setting the dt.

This is why in my comment I asked for the example sourcecode where you're modifying rows in dt - because I presumed you would have that somewhere, in order to expect that the changes would jump from Excel (which populated Thank you Alex. They save the changes and close the workbook and give it to me.

I then run my program and select * from the Excelworkbook into dt.

dataadapter not updating datatable-32dataadapter not updating datatable-82dataadapter not updating datatable-80

That will happen automatically when you navigate to to another record but you can also call private Sql Connection connection; private Sql Data Adapter adapter; private Sql Command Builder builder; private Data Table table; private void Form1_Load(object sender, Event Args e) private void add Button_Click(object sender, Event Args e) private void delete Button_Click(object sender, Event Args e) private void save Button_Click(object sender, Event Args e) Thanks again, j, once I had made the necessary conversions to C# (not a big deal, thankfully VB and C# are pretty close in this case, but could be confusing for newbies), it worked great. Even though you've already done it for yourself, I'll replace the code in case anyone else comes to this question with a similar problem.

One thought on “dataadapter not updating datatable”

  1. "I'm delighted by the huge support the film has already received on the official Facebook page and other sites on the web and am so grateful to my fans in particular, who have travelled the world to support the film at festivals and preview screenings." Tabloid interest Film producer Simon Bosanquet, from Britain's Generator Entertainment, also paid tribute to Grint's fans.