469,323 Members | 1,397 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,323 developers. It's quick & easy.

problem exporting data from asp to excel

hi
i've used the following code to transfer contents i retrieved from a database to an excel file, but it gives me an error which is quiet weird. Can anyone help me out. The foll is the asp code

<%
Response.Buffer = TRUE
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-Disposition", "attachment; filename=ErrorList.xls"
%>

<table border="0" cellpadding="6" cellspacing="1" style="border-collapse: collapse" bordercolor="#111111" id="table2" >

<%
dim con,retval
set con = server.createobject("ADODB.Connection")
con.open "Driver=SQL Server;server=fiutopiadb;initial Catalog=commercial;uid=sa;pwd=;"


Dim c1, c2
c1="#228b22"
c2="#ecf1c6"

sql1="select * from syscolumns where id=948626543"
sql2="select * from BulkUploadFailed"
sql3="select count(*) from syscolumns where id=948626543"

set rs_edp1=server.createobject("adodb.recordset")
set rs_edp2=server.createobject("adodb.recordset")
set rs_edp3=server.createobject("adodb.recordset")

rs_edp1.open sql1,con
rs_edp2.open sql2,con
rs_edp3.open sql3,con

cnt=rs_edp3(0)
rs_edp3.close
%>

<tr>

<%
do while not rs_edp1.eof
%>

<td bgcolor=<% =c1 %> ><b><font face="Verdana" size="1" color="#FFFFFF"><%=rs_edp1(0)%></font></b></td>

<%
rs_edp1.movenext
loop
rs_edp1.close
%>

</tr>

<%
dim i
do while not rs_edp2.eof
i=0
%>

<tr>

<%
do while i<cnt
%>

<td bgcolor=<% =c2 %>><b><font face="Verdana" size="1"><%=rs_edp2(i)%></font></b></td>

<%
i=i+1
loop
rs_edp2.movenext
loop
rs_edp2.close
con.close
%>

</tr>
</table>

And i get the foll error message.

Microsoft VBScript compilation error '800a0400'

Expected statement

/error_list.asp, line 2

\par




Someone please help me out. Would really appreciate it
Mar 7 '07 #1
0 892

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Chris | last post: by
1 post views Thread by Mustufa Baig | last post: by
21 posts views Thread by bobh | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.