Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8746555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:12:46+00:00 2026-06-13T12:12:46+00:00

I am populating a DataSet with data from an excel sheet. I now need

  • 0

I am populating a DataSet with data from an excel sheet. I now need to insert this data into a table in an Access database that has identical structure.

Convention would dictate that I iterate over the rows of the DataTable and make an INSERT query for each, but I was wondering if there is a more efficient way to accomplish this? Perhaps something analogous to SqlBulkCopy for SQL Server?

Here is the code I have so far:

    Dim connection As OleDbConnection = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Server.MapPath(path) & ";Extended Properties=Excel 12.0;")
    Dim adapter = New OleDbDataAdapter("SELECT * FROM [Sheet1$] WHERE EmpID IS NOT NULL", connection)
    Dim results = New System.Data.DataSet
    connection.Open()
    adapter.Fill(results)
    connection.Close()
    connection = New System.Data.OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Server.MapPath("~/App_Data/Leaves.accdb"))
    `Now, short of a loop, how can I insert results.Tables(0) into my database?

Thanks for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T12:12:47+00:00Added an answer on June 13, 2026 at 12:12 pm

    You can use ADO, for example:

    INSERT INTO Table1 ( ADate ) 
    SELECT SomeDate FROM [Excel 8.0;HDR=YES;DATABASE=Z:\Docs\Test.xls].[Sheet1$a1:a4]
    

    Where the connection is to the Access database. If you wish to use the whole sheet, refer to [Sheet1$] as your table, if you wish to use a named range, just refer to it by name.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im populating the data in the combo box using dataset tables...with some table name..now
I'm populating a CheckBoxList from database table. As per requirement, all the values should
I am populating a data grid view in my program from an SQLite3 database
We have created a custom dataset and populating it with some data. Before adding
I am populating the list view with data I am getting from a JSON
I have a very basic syntax question on Populating a dropdownlist box from dataset.
I am working on a project right now that involves receiving a message from
The reason why I am having a hard time populating this table is because
My goal is populating a section of a tableview by filling data from all
Im populating a GridView from List so am forced to use TemplateField controls to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.