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. Web Development
  3. ASP.NET
  4. hai can u make it out

hai can u make it out

Scheduled Pinned Locked Moved ASP.NET
question
4 Posts 4 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
    sooreeagt
    wrote on last edited by
    #1

    Hi i need to read an xl file into table . how can i ? plz send with code

    Suresh.R

    T V S 3 Replies Last reply
    0
    • S sooreeagt

      Hi i need to read an xl file into table . how can i ? plz send with code

      Suresh.R

      T Offline
      T Offline
      Tirthadip
      wrote on last edited by
      #2

      try the code below...this is just a snippet....you have to properly declare the variables or path of the file and you have to check for proper file name and extension also where needed.... Dim conStr As String = "provider=Microsoft.Jet.OLEDB.4.0;data source=" + filepath + "; Extended Properties=Excel 8.0;" ''"filepath" is the path of the .xls file Dim sql As String = "select * from [Sheet1$]" ''"Sheet1" is the name of the excel sheet MyConnection = New System.Data.OleDb.OleDbConnection(conStr) MyConnection.Open() MyAdapter = New System.Data.OleDb.OleDbDataAdapter(sql, MyConnection) dim myDs As DataSet = New System.Data.DataSet MyAdapter.Fill(myDs) let me know if you face any problem Tirthadip

      Live life to the fullest

      1 Reply Last reply
      0
      • S sooreeagt

        Hi i need to read an xl file into table . how can i ? plz send with code

        Suresh.R

        V Offline
        V Offline
        VaibhavTiparadi
        wrote on last edited by
        #3

        Here is a C# code //------------------------------------------- private DataSet PerformQueryIntoDataSet(string strFileName,string sheetName) { string strConn; strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + strFileName + ";" + "Extended Properties=" + Convert.ToChar(34).ToString() + "Excel 8.0;HDR=YES; IMEX=1;" + Convert.ToChar(34).ToString(); //You must use the $ after the object you reference in the spreadsheet OleDbDataAdapter myCommand = new OleDbDataAdapter("SELECT * FROM ["+ sheetName + "$]", strConn); DataSet myData = new DataSet(); myCommand.Fill(myData, sheetName); return myData; } //-------------------------------------------

        1 Reply Last reply
        0
        • S sooreeagt

          Hi i need to read an xl file into table . how can i ? plz send with code

          Suresh.R

          S Offline
          S Offline
          Sun Rays
          wrote on last edited by
          #4

          u can do this. Dim ds As New DataSet ds.ReadXml("test.xml") now this dataset can be bind to any control.

          Thanks, Sun Rays

          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