import data from excel sheet to ms access database

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Elavarasi
    New Member
    • Oct 2007
    • 11

    import data from excel sheet to ms access database

    hi

    I want to import data from excel sheet to ms access database in asp.

    sample code if possible

    regards ela...
  • Elavarasi
    New Member
    • Oct 2007
    • 11

    #2
    how to load data from excel to access

    hi all,

    i downloaded the excel file..... when i am trying to export the excel file to access database i getting the error External table is not in the expected format.

    if i select the excel file and copy to another excel file... than export.. it is working...

    to download the excel file the code i written was
    [code=asp]<%
    dim Cn,Rs
    set Cn=server.creat eobject("ADODB. connection")
    set Rs=server.creat eobject("ADODB. recordset")
    Cn.open "provider=micro soft.jet.oledb. 4.0;data source=" & server.mappath( "db1.mdb")
    Rs.open "select * from sendsms",Cn,1,3
    Response.Conten tType = "applicatio n/vnd.ms-excel"
    Response.AddHea der "Content-Disposition", "attachment ; filename=Enquir y_List.xls"
    if Rs.eof <> true then
    response.write "<table border=1>"
    while not Rs.eof

    response.write "<tr><td>" & Rs.fields("msg" ) & "</td><td>" & Rs.fields("send er") & "</td></tr>"

    Rs.movenext
    wend
    response.write "</table>"
    end if
    set rs=nothing
    Cn.close
    %>[/code]
    regards
    ela

    Comment

    • jhardman
      Recognized Expert Specialist
      • Jan 2007
      • 3405

      #3
      please don't double-post. if necessary, you may pm another member asking him or her to look at your question.

      Jared

      Comment

      • ejuly
        New Member
        • Jan 2008
        • 2

        #4
        Because the method that you use to export data to excel file is in HTML format, so you cannot read the excel file in your Import module. You have to find a way to export your data as a "TEXT" but not "HTML".

        Good Luck!

        Comment

        • ejuly
          New Member
          • Jan 2008
          • 2

          #5
          Hi,

          you may get the idea from my blog site.

          http://july-code.blogspot.c om/2008/01/export-data-to-excel-not-html-tables.html

          Good Luck!

          Comment

          Working...