PDA

View Full Version : Excel Data into ASP Page



dzigner
05 Jul 2005, 04:01 PM
Hi
I have to show excel data into an asp page. (Please dont groan, I have searched this forum, and have not found what I need)
Anyway, this is the code:




*** connection data to excel file
<%
Dim rsribbons ' recordset


' DB connection and recordset query.
Set rsribbons = Server.CreateObject("ADODB.Recordset")
midtowncnn.open dsnmidtown

strsql = "SELECT DISTINCT MfgrID,MfgrName,TypeID,TypeName FROM [Ribbons$]
order by MfgrID,TypeID;"

'Ribbons is the worksheet in my workbook.

rsribbons.open strsql,midtowncnn,0,2,1


%>

Here is the HTML code:

<td><strong>Manufacturers</strong>:
<%
do until rsribbons.eof
response.Write rsribbons("MfgrName") & ", "
rsribbons.movenext
loop
rsribbons.movefirst
%>
</td>
</tr>
<tr>
<td><strong>Ribbon Types</strong>:
<%
do until rsribbons.eof
response.Write rsribbons("TypeName") & ", "
rsribbons.movenext
loop
%>


Alright so far.
But I need to show only unique manufacturers names and unique ribbon types, which will be displayed as dropdown boxes, but that is another question. Right now, it shows all the manufacturers names, and all the ribbon types.
Any help?

Thanks