Click here to Skip to main content
15,896,912 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
XML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table border="1" cellpadding="0" cellspacing="0">
<tr>
<%
    Response.Buffer=TRUE
    ON ERROR RESUME NEXT
    dim conn,rs
    set conn=Server.CreateObject("ADODB.Connection")
    conn.connectionstring="Provider=SQLOLEDB.1;Data Source=MANIADSBHI-PC\SQLEXPRESS;Initial Catalog=master;UID=sa;Password=picme123;"
    conn.Open
        response.write err.number &"  1- " &err.description
    IF Err.Number<>0 THEN
        err_flag=true
        err_msg=err_msg+"<br><H2>Connection Error, Report can not be Generated</H2>"
        Err.Clear
    END IF

    set rs = Server.CreateObject("ADODB.recordset")
    rs.MaxRecords=20
    str="SELECT * FROM Persons"
    set rs=conn.execute(str)
        response.write err.number &"  Rs - " &err.description &"<br>"

    if rs.EOF then
        Response.Write("No Records available")
    else
    do while not rs.EOF
        response.Write("Person Details:")  & rs("PersonId") &"-" &rs("LastName") &"-" &rs("FirstName") &"-" &rs("Address") &"-" &rs("City") &"<br>"
        rs.MoveNext
        loop
    End if

%>
</body>
</html>


That is my model asp page... Any one help me fetch the table details in excel format
Posted

1 solution

Have a look here: Binding SQL Data to a Repeater Control[^]
There is a complete guide how to connect to SQL database, bind data to Repeater Control and display in Excel format ;)
 
Share this answer
 
Comments
Member 10463904 26-Feb-14 2:53am    
i need only classic asp, not C# and VB

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900