SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member zeromonster's Avatar
    Join Date
    Apr 2005
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Export dbase to an Excel file

    please help me with this script. it will export a database (Access) table to an Excel sheet.

    ----------------------------------------------------------------

    Set rsC = Server.CreateObject("ADODB.Recordset")
    rsC.Open "select * from CFL WHERE Emp_no = '"&empno&"'",myConn,1,3

    '************************** create excel file

    Response.ContentType = "application/vnd.ms-excel"
    Response.AddHeader "Content-Disposition", "attachment; filename=CFL.xls"

    IF rsC.Eof <> true THEN

    response.write "<table border=1>"

    response.write "<tr><td>" & "ID" & "</td><td>" & "School" & "</td><td>" & "Employee ID" & "</td><td>" & "Course Code" & "</td>" &_
    "<td>" & "School Year" & "</td><td>" & "Type" & "</td><td>" & "Faculty Rank" & "</td>" &_
    "<td>" & "Section" & "</td><td>" & "Days" & "</td><td>" & "Time" & "</td>" &_
    "<td>" & "Duration" & "</td><td>" & "Units" & "</td>"

    while not rsC.eof

    response.write "<tr><td>" & rsC.fields("id") & "</td><td>" & rsC.fields("school_code") & "</td><td>" & rsC.fields("Emp_no") & "</td><td>" & rsC.fields("cors_code") & "</td>" &_
    "<td>" & rsC.fields("schl_yr_code") & "</td><td>" & rsC.fields("course_type") & "</td><td>" & rsC.fields("faculty_rank") & "</td>" &_
    "<td>" & rsC.fields("cfl_section") & "</td><td>" & rsC.fields("days") & "</td><td>" & rsC.fields("timex") & "</td>" &_
    "<td>" & rsC.fields("duration") & "</td><td>" & rsC.fields("noUnits") & "</td>"

    rsC.movenext
    wend

    response.write "</table>"

    END IF

    set rsC=nothing
    myConn.close


    ------------------------------------------------------------------------

    my script is working properly but i want to create another sheet of the Excel file because i will export multiple tables from the dtabase to an Excel file with multiple sheets. it only creates one sheet. can someone help me here?

    regards
    zero

  2. #2
    SitePoint Member zeromonster's Avatar
    Join Date
    Apr 2005
    Posts
    18
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    please help me with dis....


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •