?
Solved

datagridview to database

Posted on 2012-03-21
2
Medium Priority
?
297 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 2000 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses
Course of the Month10 days, 12 hours left to enroll

764 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