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.
Subject
Views
Written By
Posted
12013
October 17, 2008 02:55PM
4258
October 20, 2008 10:59AM
3294
October 20, 2008 02:19PM
4038
October 27, 2008 11:49AM
2729
October 27, 2008 12:43PM
2344
October 28, 2008 08:39AM
2684
October 28, 2008 09:09AM
Re: convert database items into text file
3160
October 29, 2008 10:15AM
2731
October 31, 2008 02:36AM
2894
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.