Solved

datagridview to database

Posted on 2012-03-21
2
286 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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 …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 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

8 Experts available now in Live!

Get 1:1 Help Now