Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Copy Excel Data into Access Database Table.

Copy Excel Data into Access Database Table.

Scheduled Pinned Locked Moved Database
databasetutorialquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jeshra279
    wrote on last edited by
    #1

    Hi All, I have one Excel sheet "Student.xls", which has different worksheet as "Sheet1","Sheet2"..like that. Consider now "Sheet1"; it has 3 columns - "Name", "Age", "Sex". All these columns has row entries. Now I have one access database, "alldata.mdb". It has One table "Record" which has 3 fields as same as column name of Excel sheet-- "Name", "Age", "Sex". I want to populate this access database with the entries of Excel sheet from "Sheet1". Can someone let me know how to do this? I tried this: // first connected xl datasheet: Dim filename As String = "C:\Student.xls" Dim con As String con = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & filename & ";" & "Extended Properties=Excel 8.0;" Dim connection As OleDbConnection = New OleDbConnection(con) connection.Open() The above Excel connection was succesful, but how to import the data from this excel sheet into the access database. Please suggest. Thanks, R.S.

    J 1 Reply Last reply
    0
    • J jeshra279

      Hi All, I have one Excel sheet "Student.xls", which has different worksheet as "Sheet1","Sheet2"..like that. Consider now "Sheet1"; it has 3 columns - "Name", "Age", "Sex". All these columns has row entries. Now I have one access database, "alldata.mdb". It has One table "Record" which has 3 fields as same as column name of Excel sheet-- "Name", "Age", "Sex". I want to populate this access database with the entries of Excel sheet from "Sheet1". Can someone let me know how to do this? I tried this: // first connected xl datasheet: Dim filename As String = "C:\Student.xls" Dim con As String con = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & filename & ";" & "Extended Properties=Excel 8.0;" Dim connection As OleDbConnection = New OleDbConnection(con) connection.Open() The above Excel connection was succesful, but how to import the data from this excel sheet into the access database. Please suggest. Thanks, R.S.

      J Offline
      J Offline
      Jorgen Andersson
      wrote on last edited by
      #2

      Select * FROM [Sheet1$] or however your query looks like. Enter the data into a dataset. Open a new connection to the alldata.mdb and copy the data from the dataset.

      "When did ignorance become a point of view" - Dilbert

      J 1 Reply Last reply
      0
      • J Jorgen Andersson

        Select * FROM [Sheet1$] or however your query looks like. Enter the data into a dataset. Open a new connection to the alldata.mdb and copy the data from the dataset.

        "When did ignorance become a point of view" - Dilbert

        J Offline
        J Offline
        jeshra279
        wrote on last edited by
        #3

        Hi, I have copied the data in a new dataset "ds1". Please tell me how to copy this "ds1" contents into Access Database. I am trying with following: Dim da2 As New OleDbDataAdapter Dim conn As OleDbConnection Dim cmd As OleDbCommand = New OleDbCommand() conn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\alldata.mdb;") cmd = New OleDbCommand("SELECT * FROM Denver", con) da2 = New OleDbDataAdapter(cmd) da1.Fill(ds1, "Denver") But not able to populate the excel sheet. Can You guide me how to do this?? Thanks, R.S.

        J 1 Reply Last reply
        0
        • J jeshra279

          Hi, I have copied the data in a new dataset "ds1". Please tell me how to copy this "ds1" contents into Access Database. I am trying with following: Dim da2 As New OleDbDataAdapter Dim conn As OleDbConnection Dim cmd As OleDbCommand = New OleDbCommand() conn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\alldata.mdb;") cmd = New OleDbCommand("SELECT * FROM Denver", con) da2 = New OleDbDataAdapter(cmd) da1.Fill(ds1, "Denver") But not able to populate the excel sheet. Can You guide me how to do this?? Thanks, R.S.

          J Offline
          J Offline
          jeshra279
          wrote on last edited by
          #4

          Sorry By mistake.... I made the statement "But not able to populate the excel sheet." What i was: "But Not able to populate the Access Database". Thanks R.S.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups