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. Web Development
  3. ASP.NET
  4. Export from MSExcel to MSSQL2000

Export from MSExcel to MSSQL2000

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdatabasequestion
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.
  • V Offline
    V Offline
    Vipin d
    wrote on last edited by
    #1

    hai frndz, i want to export datafrom msexcel to a table 'stock' in the mssql2000 database. excel sheet containing "item code" and "qty" table fileds are code varchar(30) not null qty decemal(9,2) not null userid varchar(30) null dtwrk smalldatetime null i want to creat a asp.net interface to upload data from excelsheet to my database table 'stock'. is it possible? plz send any linkor some sample code.... with regards :-D All I ever wanted is what others have.... CrazySanker

    R 1 Reply Last reply
    0
    • V Vipin d

      hai frndz, i want to export datafrom msexcel to a table 'stock' in the mssql2000 database. excel sheet containing "item code" and "qty" table fileds are code varchar(30) not null qty decemal(9,2) not null userid varchar(30) null dtwrk smalldatetime null i want to creat a asp.net interface to upload data from excelsheet to my database table 'stock'. is it possible? plz send any linkor some sample code.... with regards :-D All I ever wanted is what others have.... CrazySanker

      R Offline
      R Offline
      russellsoft
      wrote on last edited by
      #2

      In this case you can use Jet OleDb Provider or Micrisoft Excel object model... Using Jet it will be looking like the following: string ConnectionStr = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Mode=ReadWrite;Extended Properties=EXCEL 8.0;Persist Security Info=False;", _file_path_); OleDbConnection conn = new OleDbConnection(ConnectionStr); conn.Open(); DataTable schemaTable = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] {null, null, null, "TABLE"}); foreach(DataRow drTables in schemaTable.Rows) { string TableName = drTables[2].ToString(); DataSet ds = _fill_data_set_("select * from [" + TableName + "]", conn); } in this code: file_path - full path to your Excel-file on hard disc fill_data_set - some function, which fills get DataSet then using selected from Excel-file data (which is in ds object) you insert it into your MSSQL2000 table... How to do this I think you know...

      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