MySQL Forums
Forum List  »  MySQL Workbench

Re: convert database items into text file
Posted by: Kevin Dong
Date: October 29, 2008 10:15AM

Hi, Michael:

I am trying to display/edit/update the data using DataGridView control from VisualStudio2005. So far I got display and edit working, but no luck for the update.

What I am using is MySQL ODBC 5.1 driver, and this is the code I tried:
So far, display and edit works fine with this code:
========================================================
string selCmd = "select * from " + selectCommand;
// Create a new data adapter based on the specified query.
dataAdapter = new OdbcDataAdapter(selCmd, ConStr);

// Populate a new data table and bind it to the BindingSource.
DataTable table = new DataTable();

table.Locale = System.Globalization.CultureInfo.InvariantCulture;
dataAdapter.Fill(table);
bindingSource1.DataSource = table;
========================================================

But when I try to update table with this code, it doesn't work:
========================================================
// Update the database with the user's changes.
dataAdapter.Update((DataTable)bindingSource1.DataSource);
========================================================

I find in QB that after "Edit" button is pressed, user can enter data into table, and after that "Apply Changes" will do the real job. This is exactly what I want.

Could you please give me some hints on how is this "Apply Changes" button implemented? Any sample code will help.

Thanks!

Regards,
Kevin



Edited 1 time(s). Last edit at 10/29/2008 10:16AM by Kevin Dong.

Options: ReplyQuote


Subject
Views
Written By
Posted
11399
October 17, 2008 02:55PM
Re: convert database items into text file
3098
October 29, 2008 10:15AM
2818
November 01, 2008 02:58AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.