<% if Request.QueryString("optOutput") = "Excel" then Response.ContentType ="Application/vnd.excel" Response.AddHeader "Content-Disposition", "attachment; filename=Employee-" + mySqlDateTimeFormat(now) +".xls" output = "Excel" end if if output = "Excel" then headerandcheckfile = "none.asp" dbaccessfile = "none.asp" else headerandcheckfile = "headerandcheck.inc" dbaccessfile = "dbaccess.inc" end if %> <% if output = "Excel" then else response.write "Employee Excel Export
" response.write "
" response.write "
" response.write "
Back to Main Menu

" end if Dim Conn Dim subRS Set Conn = Server.CreateObject("ADODB.Connection") Set subRS = Server.CreateObject("ADODB.Recordset") conn.Open(connStr) sql = "" + _ "SELECT emp_id AS EMPID, card_no AS CARDNO, emp_name AS NAME, department AS DEPARTMENT, " + _ "sup_id AS SUPID, email AS EMAIL, jobtitle AS JOBTITLE, shift AS SHIFT, " + _ "esdtesting AS TEST, wslo AS WSLO, wshi AS WSHI, shlo AS SHLO, shhi AS SHHI, " + _ "costcenter AS COSTCENTER, labortype AS LABORTYPE " + _ "from " + _ "(SELECT * FROM employee WHERE (status<>'INACTIVE' AND emp_id <> 'DEFAULT')) employee " + _ " ORDER BY empid " 'response.write "
" + sql + "
" 'response.flush ' 'response.end subRS.Open sql, conn, 2, 3 if err then response.write "Error Encountered" response.write "
" + sql + "
" response.write "

" response.end end if if subRS.EOF = False then response.write "" end if 'maxCol = 40 maxCol = subRS.Fields.Count-1 response.write "" for n = 0 to maxCol response.write "" next response.write "" while subRS.EOF = False response.write "" for n = 0 to maxCol if output = "Excel" then response.write "" next response.write "" subRS.movenext wend response.write "
" response.write "" + cstr(subrs.fields(n).name) response.write "
" else response.write "" end if response.write cstr(subrs.fields(n)) response.write "
" response.flush conn.Close if output = "Excel" then else response.write "
" response.write "DONE" end if %>