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
  1. Home
  2. Database & SysAdmin
  3. Database
  4. importing excel sheet into a database table [modified]

importing excel sheet into a database table [modified]

Scheduled Pinned Locked Moved Database
databasedotnetsysadmincollaborationhelp
2 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.
  • S Offline
    S Offline
    sivaram praveen
    wrote on last edited by
    #1

    hi, In my application i need to import the excel sheet data into a database table "Emp_Profile_Tbl" which is created in the database. Dim connstr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("Team wise EMP Profile (2).xls") + ";Extended Properties=Excel 8.0;" Dim objconn As New OleDbConnection(connstr) Dim ds As New DataSet Dim objadapter As New OleDbDataAdapter("SELECT * FROM [Sheet1$]", objconn) objadapter.TableMappings.Add("Table", "Emp_Profile_Tbl") Try 'in excel: insert->name->seleziono il range:nomi objconn.Open() objadapter.Fill(ds) dg_empprofile.DataSource = ds.Tables(0).DefaultView dg_empprofile.DataBind() Finally objconn.Close() End Try i'm getting the values into datgrid but the values are not saving in "Emp_Profile_Tbl" database table. pls help me to sort this out. Thank u,

    modified on Thursday, December 13, 2007 2:37:51 AM

    P 1 Reply Last reply
    0
    • S sivaram praveen

      hi, In my application i need to import the excel sheet data into a database table "Emp_Profile_Tbl" which is created in the database. Dim connstr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("Team wise EMP Profile (2).xls") + ";Extended Properties=Excel 8.0;" Dim objconn As New OleDbConnection(connstr) Dim ds As New DataSet Dim objadapter As New OleDbDataAdapter("SELECT * FROM [Sheet1$]", objconn) objadapter.TableMappings.Add("Table", "Emp_Profile_Tbl") Try 'in excel: insert->name->seleziono il range:nomi objconn.Open() objadapter.Fill(ds) dg_empprofile.DataSource = ds.Tables(0).DefaultView dg_empprofile.DataBind() Finally objconn.Close() End Try i'm getting the values into datgrid but the values are not saving in "Emp_Profile_Tbl" database table. pls help me to sort this out. Thank u,

      modified on Thursday, December 13, 2007 2:37:51 AM

      P Offline
      P Offline
      pmarfleet
      wrote on last edited by
      #2

      sivaram praveen wrote:

      i'm getting the values into datgrid but the values are not saving in "Emp_Profile_Tbl" database table.

      You haven't written any code to save the data back to your database, so it's hardly surprising that nothing is happening. You need to specify insert/update/delete commands for your data adapter so that changes to the dataset can be propagated back to the database. Read this article[^] for more information.

      Paul Marfleet "No, his mind is not for rent To any God or government" Tom Sawyer - Rush

      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