Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Response.ContentType to display ASP page as a Word document

Status
Not open for further replies.

eguthrie

Programmer
Nov 30, 2001
51
US
I'm trying to use Response.ContentType to display an ASP page as a Word document. In the page, I'm trying to display data from an ADO recordset. The page DOES load as a Word document, but no values from the recordset show on the page.

(I know that the recordset does contain data, because if I comment out the line that sets the ContentType, the recordset values do get displayed in the ASP page.)

I hope someone can tell me why this doesn't work? Here is my code:

<%
Response.Buffer = TRUE
Response.ContentType = &quot;application/msword&quot;

dim rs
Set rs = server.CreateObject(&quot;ADODB.Recordset&quot;)
rs.Open &quot;EXECUTE usp_GetGroup 8234&quot;, strConnection, adOpenStatic, adLockReadOnly
%>

<HTML>
<HEAD>
<TITLE>Test Page</TITLE>
</HEAD>
<BODY>
<TABLE>
<TR>
<TD><%=rs(&quot;groupName&quot;)%></TD>
</TR>
<TR>
<TD><%=rs(&quot;firstName&quot;) & &quot; &quot; & rs(&quot;lastName&quot;)%></TD>
</TR>
</TABLE>
</BODY>
</HTML>

<%
rs.close()
set rs = nothing
%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top