Solved

datagridview to database

Posted on 2012-03-21
2
290 Views
Last Modified: 2012-03-23
Hi guys,

I am using a datagridview on a windows form and i have added the columns using the properties window.

After executing the application i entered the data manually.

The datagridview has 5 columns which was created at design time.

Then the data in the columns were just typed manually by hand.

Now i need to send those data into a database. So this is the code that i need.

I am using Vb.net and access 2007 database.

Thanks in advance.
0
Comment
Question by:baabaa_nl
2 Comments
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 37749450
You need to loop through the rows of your datagrid.

for each row, you will need to write an insert statement to add the row to the database.

see http://msdn.microsoft.com/en-us/library/ms971485.aspx and http://www.vbforums.com/showthread.php?t=511090
0
 

Author Comment

by:baabaa_nl
ID: 37753393
I couldn't find any code getting the gridview data to the database.

Could you please give me the code for that.


Also if possible please give the code to export the data from the gridview to a datatable and then from the datatable to a database.

Thanks in advance.
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

930 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now