By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,149 Members | 885 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,149 IT Pros & Developers. It's quick & easy.

How to update dataGridView and also update database?

P: 6
i have this code:

Expand|Select|Wrap|Line Numbers
  1. string conString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\\Users\\Khai\\Documents\\MyNum…
  2. string queryM = "SELECT * FROM magnum WHERE todayDate = #" + pickedDate.Date + "#";
  3. OleDbDataAdapter dAdapterM = new OleDbDataAdapter(queryM, conString);
  4. OleDbCommandBuilder cBuilderM = new OleDbCommandBuilder(dAdapterM);
  5. DataTable dtableM = new DataTable();
  6.  
  7. dAdapterM.Fill(dtableM); 
  8. BindingSource bSourceM = new BindingSource();
  9. bSourceM.DataSource = dtableM;
  10. magnumView.DataSource = dtableM; 
  11.  
  12. dAdapterM.Update(dtableM);

when the data on the dataGridView change, the original database also update by it self, but it cant be done.. i have search for many place.. but didn get the thing also
May 29 '10 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 750
PRR
Could you be more clear? Can you clearly define what you want to do?
May 31 '10 #2

Post your reply

Sign in to post your reply or Sign up for a free account.