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. Regarding Importing excel file to asp.net page

Regarding Importing excel file to asp.net page

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-netquestion
3 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
    sandhya14
    wrote on last edited by
    #1

    i have exported file to Excel......nw i need to retrieve the same excel file to my asp.net application My excel file is like the given below :- AssetID Description AssetTag 1246 hello me(1246) 10103001245 1247 hi me(1247) 10103001246 when am trying to import, am getting an error like " External table is not in the expected format " wht might be the prblm..... can anyone help me?

    R 1 Reply Last reply
    0
    • S sandhya14

      i have exported file to Excel......nw i need to retrieve the same excel file to my asp.net application My excel file is like the given below :- AssetID Description AssetTag 1246 hello me(1246) 10103001245 1247 hi me(1247) 10103001246 when am trying to import, am getting an error like " External table is not in the expected format " wht might be the prblm..... can anyone help me?

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

      add this code Response.Clear(); Response.ContentType = "application/vnd.ms-excel"; Response.AddHeader("content-disposition", "attachment;filename=DCNReport.xls"); Response.Charset = ""; this.EnableViewState = false;

      r_palanivel83 10:01 4 Jan '06

      S 1 Reply Last reply
      0
      • R R Palanivel

        add this code Response.Clear(); Response.ContentType = "application/vnd.ms-excel"; Response.AddHeader("content-disposition", "attachment;filename=DCNReport.xls"); Response.Charset = ""; this.EnableViewState = false;

        r_palanivel83 10:01 4 Jan '06

        S Offline
        S Offline
        sandhya14
        wrote on last edited by
        #3

        This is for while exporting the file..... my code is like ths:- Dim excelname As String = FileUpload1.PostedFile.FileName Dim intFileNameLength As Integer = InStr(1, StrReverse(excelname), "\") strFileName = Mid(excelname, (Len(excelname) - intFileNameLength) + 2) Dim namewe As String = System.IO.Path.GetFileNameWithoutExtension(strFileName) Dim sWorkbook As String = namewe + "$" FileUpload1.PostedFile.SaveAs(Server.MapPath("ImportFiles/") + namewe + ".xls") Dim oledbconn As OleDbConnection = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("ImportFiles/") + namewe + ".xls ;Extended Properties=Excel 8.0;") Comm.CommandText = "SELECT AssetID,Description,AssetTag FROM [" & sWorkbook & "]" Comm.CommandType = Data.CommandType.Text Comm.Connection = oledbconn oledbadap.SelectCommand = Comm oledbadap.Fill(oledbdatatbl) GrdImpScanner.DataSource = oledbdatatbl.DefaultView GrdImpScanner.DataBind() am getting the error in this line :- " oledbadap.Fill(oledbdatatbl) "

        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