Hi:
I am using this Response.ContentType "application/vnd.ms-excel" in my code to bring place an excel looking like document on the browser. But it seems not to be filling in the data. What can I do to make it fill in the data?
<%@ Language=VBScript %>
<%
Response.Expires = -1000
Response.ContentType = "application/vnd.ms-excel"
Response.Write "<HTML>"
Response.Write "<HEAD>"
Response.Write "</HEAD>"
Response.Write "<BODY>"
Dim rs
Dim strFile_Lookup
Dim strFile_Function
Dim fso
Dim ts
Dim strSQL
Dim strLine
strFile_Lookup = ""
strFile_Function = ""
strFile_Function = strFile_Function & "Function Productivity()" & vbcrlf
strSQL= "SELECT [A].[LastName] + ' , ' + [A].[FirstName] AS Analyst, [M].[LastName] + ' , ' + [M].[FirstName] AS Manager, A.CCNum, TAS_TimeProdData.dblHours AS Total_Hours, TAS_validTimeProdCodes.TPCode AS Category, TAS_TimeProdData.dtsDate "
strSQL = strSQL & "FROM (TAS_PeopleDynamic AS A INNER JOIN (TAS_TimeProdData INNER JOIN TAS_validTimeProdCodes ON TAS_TimeProdData.TPCodeID = TAS_validTimeProdCodes.TPCodeID) ON A.UID = TAS_TimeProdData.UID) INNER JOIN TAS_PeopleDynamic AS M ON A.MgrUID = M.UID "
'strSQL = strSQL & "WHERE A.CCNum='" & CCNum & "' AND TAS_TimeProdData.dtsDate Between '" & StartDate & "' AND '" & EndDate & "'ORDER BY dtsDate"
strSQL = strSQL & "WHERE A.CCNum='1867' AND TAS_TimeProdData.dtsDate Between '01/01/04' AND '01/01/04'ORDER BY dtsDate"
OpenADOConn
set rs = server.CreateObject("ADODB.Recordset"
rs.Open strSQL, ADOConn, 1, 3 'adOpenKeyset , optimistic
strLine=""
For each x in rs.Fields
strLine = strLine & x.name & chr(9)
Next
strLine = strLine & vbcrlf
do while not rs.EOF
for each x in rs.Fields
strLine = strLine & x.value & chr(9)
Next
rs.MoveNext
strLine = left(strLine, len(strLine)-1) & vbcrlf
Loop
rs.close
set rs = nothing
CloseADOConn
strFile_Function = strFile_Function & "End function" & vbcrlf
Dim strFileNameRelative
set fso = server.CreateObject("scripting.FileSystemObject"
strFileNameRelative = "..\images\tmpxls\TAS_Prod_" & GetNTLogin & ".xls"
strFileName = server.MapPath(strFileNameRelative)
Set ts = fso.CreateTextFile(strFileName, True)
ts.writeline strLine
ts.Close
Set ts=Nothing
Set fso=Nothing
Response.Write "</BODY>"
Response.Write "</HTML>"
%>
I am using this Response.ContentType "application/vnd.ms-excel" in my code to bring place an excel looking like document on the browser. But it seems not to be filling in the data. What can I do to make it fill in the data?
<%@ Language=VBScript %>
<%
Response.Expires = -1000
Response.ContentType = "application/vnd.ms-excel"
Response.Write "<HTML>"
Response.Write "<HEAD>"
Response.Write "</HEAD>"
Response.Write "<BODY>"
Dim rs
Dim strFile_Lookup
Dim strFile_Function
Dim fso
Dim ts
Dim strSQL
Dim strLine
strFile_Lookup = ""
strFile_Function = ""
strFile_Function = strFile_Function & "Function Productivity()" & vbcrlf
strSQL= "SELECT [A].[LastName] + ' , ' + [A].[FirstName] AS Analyst, [M].[LastName] + ' , ' + [M].[FirstName] AS Manager, A.CCNum, TAS_TimeProdData.dblHours AS Total_Hours, TAS_validTimeProdCodes.TPCode AS Category, TAS_TimeProdData.dtsDate "
strSQL = strSQL & "FROM (TAS_PeopleDynamic AS A INNER JOIN (TAS_TimeProdData INNER JOIN TAS_validTimeProdCodes ON TAS_TimeProdData.TPCodeID = TAS_validTimeProdCodes.TPCodeID) ON A.UID = TAS_TimeProdData.UID) INNER JOIN TAS_PeopleDynamic AS M ON A.MgrUID = M.UID "
'strSQL = strSQL & "WHERE A.CCNum='" & CCNum & "' AND TAS_TimeProdData.dtsDate Between '" & StartDate & "' AND '" & EndDate & "'ORDER BY dtsDate"
strSQL = strSQL & "WHERE A.CCNum='1867' AND TAS_TimeProdData.dtsDate Between '01/01/04' AND '01/01/04'ORDER BY dtsDate"
OpenADOConn
set rs = server.CreateObject("ADODB.Recordset"
rs.Open strSQL, ADOConn, 1, 3 'adOpenKeyset , optimistic
strLine=""
For each x in rs.Fields
strLine = strLine & x.name & chr(9)
Next
strLine = strLine & vbcrlf
do while not rs.EOF
for each x in rs.Fields
strLine = strLine & x.value & chr(9)
Next
rs.MoveNext
strLine = left(strLine, len(strLine)-1) & vbcrlf
Loop
rs.close
set rs = nothing
CloseADOConn
strFile_Function = strFile_Function & "End function" & vbcrlf
Dim strFileNameRelative
set fso = server.CreateObject("scripting.FileSystemObject"
strFileNameRelative = "..\images\tmpxls\TAS_Prod_" & GetNTLogin & ".xls"
strFileName = server.MapPath(strFileNameRelative)
Set ts = fso.CreateTextFile(strFileName, True)
ts.writeline strLine
ts.Close
Set ts=Nothing
Set fso=Nothing
Response.Write "</BODY>"
Response.Write "</HTML>"
%>