SQL ~ ASP - HELP PLZ

  • Folks, I jus need to write a simple ASP page to pull records [either select, view results from sql and display it on web page]....

    Ideally, I would make the asp page for reporting purpose... I understand this cant be answered here...jsut give me the pointers [useful url's, link to some sites] for me to get started.....

    Thanks for the help here...


    Get busy living ....or get busy dying....

  • If it is simple you are after, have a look at sp_makewebtask in BOL.

  • I just googled "ASP select sql" and lots of sites came up that seemed like they would help you.  There are lots of forums that are more oriented towards ASP than SQL, and I think you would get better answers in one of them.

    Dick

     

  • Here's a simple one; it won't run because I've removed some stuff and you need the include, which is the connection string, but it will give you an idea:

    <!--#Include File="sqldef.asp"-->

    <%

    FirstLogID = Request.Querystring("FirstLogID")

    LastLogID = Request.Querystring("LastLogID")

    set conntemp=server.createobject("adodb.connection")

    conntemp.open myDSN

    mySQL="select a.TransmissionID, a.Description from TransmissionMaster a, TransmissionLogPointer b where a.TransmissionID = b.TransmissionID"

    set rstemp=conntemp.execute(mySQL)

    TransmissionID = rstemp("TransmissionID")

    Transmission = rstemp("Description")

    mySQL="Select * from TransmissionLog where LogID between " & FirstLogID & " and " & LastLogID

    set rstemp=conntemp.execute(mySQL)

    howmanyfields=rstemp.fields.count - 1

    'response.write "howmanyfields=" & howmanyfields & "<br>"

    %>

    <html><head>

    <title>Edge Pull Transmission Report</title>

    <meta http-equiv="pragma" content="no-cache">

    </head>

    <body bgcolor="#FFFFFF" bgproperties="fixed">

    <B>Detail Log for Transmission <%=TransmissionID%> (<%=Transmission%&gt<br></B>

    <table border="1" width="100%" align="left" bgcolor="#FFFFFF">

    <tr>

    <%

    for i = 0 to howmanyfields%>

     <td valign="top" class="clsTablebody"><%=rstemp.fields(i).name%>&nbsp;</td>

    <% next %>

    </tr>

    <% do  while not rstemp.eof %>

     <tr>

        <% for i = 0 to howmanyfields%>

               <td valign="top" class="clsTablebody"><%=rstemp(i)%>&nbsp;</td>

     <% next %>

     </tr>

    <%

     rstemp.movenext

    loop

    rstemp.close

    set rstemp=nothing

    conntemp.close

    set conntemp=nothing

    %>

    </table>

    </body>

    </html>

  • http://www.asp101.com has easy to follow tutorials on how to do this. Just go to the samples section.


    My blog: SQL Soldier[/url]
    SQL Server Best Practices:
    SQL Server Best Practices
    Twitter: @SQLSoldier
    My book: Pro SQL Server 2008 Mirroring[/url]
    Microsoft Certified Master: SQL Server, Data Platform MVP
    Database Engineer at BlueMountain Capital Management[/url]

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply