Results 1 to 2 of 2

Thread: Writing a simple reports from ASP

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Slovenia
    Posts
    40
    Hi
    Can anybody tell me how to write a simple report
    based on databased query!
    Thanks,
    Tomaz

  2. #2
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    If you just trying to display data from a database that's pretty easy:

    Code:
    <%
    Dim cn
    Dim rs
    Dim strSQL
    Dim intLoop
    
    Set cn = Server.CreateObject("ADODB.Connection")
    cn.ConnectionString = "Provider=SQLOLEDB;Server=" & servername & ";Database=" & dbname & ";UID=" & userid & ";Pwd=" & pwd & ";"
    cn.Open
    
    strSQL = "Select * from table"
    
    Set rs = cn.Execute(strSQL,9999999)
    %>
    <HTML>
    <BODY>
    <TABLE border=1 cellspacing=0 cellpadding=0>
    <%Do until rs.EOF%>
    <TR>
    <%For intLoop = 0 to rs.Fields.Count - 1%>
      <TD><%rs.Fields(intLoop)%></TD>
    <%Next%>
    </TR>
    <%rs.MoveNext%>
    <%Loop%>
    </TABLE>
    </BODY>
    </HTML>
    <%
    rs.Close
    cn.Close
    Set rs = Nothing
    Set cn = Nothing
    %>

    Now if your talking about doing something in Crystal, well... that puts a whole new paint job on things...
    It's a little more complicated but not that difficult.

    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width