SitePoint Member
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
SitePoint Member
please help me with dis....
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks