Ver Mensaje Individual
  #5 (permalink)  
Antiguo 04/05/2002, 13:08
galindox
 
Fecha de Ingreso: enero-2002
Mensajes: 141
Antigüedad: 22 años, 4 meses
Puntos: 0
Re: De vuelta con asp y Excel.. (Desesperación)

no se si esto te sirva
mira este ejemplo lo mas importante es la primera linea que indica que abra todo como excel

<%
2 Response.ContentType = "application/vnd.ms-excel"
3
4 set conntemp=server.createobject("adodb.connectio n")
5 cnpath="DBQ=" & server.mappath("/stevesmith/data/timesheet.mdb")
6 conntemp.Open "DRIVER={Microsoft Access Driver (*.mdb)}; " & cnpath
7 set RS=conntemp.execute("select * from donut")
8 %>
9 <TABLE BORDER=1>
10 <TR>
11 <%
12 ' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
13 ' % Loop through Fields Names and print out the Field Names
14 ' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15 j = 2 'row counter
16 For i = 0 to RS.Fields.Count - 1
17 %>
18 <TD><B><% = RS(i).Name %></B></TD>
19 <% Next %>
20 <TD><B>On Hand (calculated)</B></TD>
21 <TD><B>Gross (calculated)</B></TD>
22 </TR>
23 <%
24 ' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25 ' % Loop through rows, displaying each field
26 ' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27 Do While Not RS.EOF
28 %>
29 <TR>
30 <% For i = 0 to RS.Fields.Count - 1
31 %>
32 <TD VALIGN=TOP><% = RS(i) %></TD>
33 <% Next %>
34 <TD>=b<%=j%>-c<%=j%>-d<%=j%></TD>
35 <TD>=d<%=j%>*e<%=j%></TD>
36 </TR>
37 <%
38 RS.MoveNext
39 j = j + 1
40 Loop
41 ' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42 ' % Make sure to close the Result Set and the Connection object
43 ' %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
44 RS.Close
45 %>
46 <TR BGCOLOR=RED>
47 <TD>Totals</TD>
48 <TD>=SUM(B2:B6)</TD>
49 <TD>=SUM(C2:C6)</TD>
50 <TD>=SUM(D2:D6)</TD>
51 <TD>n/a</TD>
52 <TD>=SUM(F2:F6)</TD>
53 <TD>=SUM(G2:G6)</TD>
54 </TABLE>