exporting dgv data to ms access.

jsj1411

New member
Joined
May 25, 2012
Messages
3
Programming Experience
Beginner
i have a datagridview in my vb.net form displaying data from ms access file A , table A , is it possible for me to export the data's in the data gridview to ms access file A table B by using a button?? i'm not using sql.
 
is it possible ... by using a button?
All a Button does is raise its Click event. It has nothing to do with saving data to a database or anything else for that matter. The Button raises the Click event when the user clicks it and you handle the event. That's the sum total of the Button's involvement. You need to write code to perform your desired action and place that code in the event handler. The action can be pretty much anything you want. The Button doesn't care. By the same token, that same code could be placed elsewhere to perform the same task without the involvement of a Button, e.g. the Tick event handler of a Timer or the Load event handler of the form.
i'm not using sql.
Yes you are. SQL is not a database. SQL is the language used to interact with databases and pretty much all databases use it, including Access.

Normally, you would use a data adapter to retrieve data into a DataTable, display that data and let the user edit it and then use the same data adapter to save the data back to the same table. What you're asking for is basically no different. All you have to do is specify a different table in the SQL to save the data to the one in the SQL to retrieve the data. The only other difference is that you would need to set the AcceptChangesDuringFill property of the adapter to True, so that all the rows were ready to be inserted when saved. Check this out for an example of using a data adapter:

Retrieving and Saving Data in Databases
 
Back
Top