QueryString asp to asp.net

Discussion in 'ASP .Net' started by Patrick.O.Ige, Oct 9, 2004.

  1. I have 2 asp files below:-
    The first one displays OFFERS with the ServID and ServiceName (whcih is the
    LINKS)-services.asp
    The second one displays the data where servid = querystringID -offer.asp
    Whats the best way to change these FILES to ASP.NET and how
    Thanks

    services.asp
    --------------
    Dim Conn
    Dim rsCat
    Dim strSQL

    Set Conn = Server.CreateObject("ADODB.Connection")
    Conn.Open = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & Server.MapPath("..\db\business.mdb")

    Set rsCat = Server.CreateObject("ADODB.Recordset")

    strSQL = "SELECT * FROM services1"
    Set rsCat = Conn.Execute(strSQL)

    %>
    <%
    Do While Not rsCat.EOF
    Response.Write "<img src='form_handler.gif'><a
    href=""offers.asp?catID=" & rsCat("ServID") & """>" & rsCat("ServiceName") &
    "</a><br><br>"
    rsCat.Movenext
    Loop
    %>

    <%
    rsCat.Close
    Conn.Close
    %>

    --------------------------------------------------------------------
    OFFERS.asp

    <%
    Dim Conn
    Dim rsProd
    Dim strSQL
    Set Conn = Server.CreateObject("ADODB.Connection")

    Conn.Open = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & Server.MapPath("..\db\business.mdb")

    Set rsProd = Server.CreateObject("ADODB.Recordset")
    strSQL = "SELECT * FROM offers " & "WHERE ServID = " &
    Request.QueryString("catID") & " " & "ORDER BY Description"
    Set rsProd = Conn.Execute(strSQL)
    %>
    <body>

    <ul>
    <%
    Do While Not rsProd.EOF
    Response.Write rsProd("Description")


    rsProd.Movenext
    Loop
    %>

    <%
    rsProd.Close
    Conn.Close
    %>
     
    Patrick.O.Ige, Oct 9, 2004
    #1
    1. Advertising

  2. Open QuickStart tutorial, there you can find exact guide of simple port ASP
    to ASP.Net.

    In simple words, just rename .asp to .aspx, correct their syntax and this is
    all.
    Do not forget to set compatibility mode in the beginning of files like this:

    <%@ Page Language="vb" AspCompat=True %>


    "Patrick.O.Ige" wrote:

    > I have 2 asp files below:-
    > The first one displays OFFERS with the ServID and ServiceName (whcih is the
    > LINKS)-services.asp
    > The second one displays the data where servid = querystringID -offer.asp
    > Whats the best way to change these FILES to ASP.NET and how
    > Thanks
    >
    > services.asp
    > --------------
    > Dim Conn
    > Dim rsCat
    > Dim strSQL
    >
    > Set Conn = Server.CreateObject("ADODB.Connection")
    > Conn.Open = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    > "Data Source=" & Server.MapPath("..\db\business.mdb")
    >
    > Set rsCat = Server.CreateObject("ADODB.Recordset")
    >
    > strSQL = "SELECT * FROM services1"
    > Set rsCat = Conn.Execute(strSQL)
    >
    > %>
    > <%
    > Do While Not rsCat.EOF
    > Response.Write "<img src='form_handler.gif'><a
    > href=""offers.asp?catID=" & rsCat("ServID") & """>" & rsCat("ServiceName") &
    > "</a><br><br>"
    > rsCat.Movenext
    > Loop
    > %>
    >
    > <%
    > rsCat.Close
    > Conn.Close
    > %>
    >
    > --------------------------------------------------------------------
    > OFFERS.asp
    >
    > <%
    > Dim Conn
    > Dim rsProd
    > Dim strSQL
    > Set Conn = Server.CreateObject("ADODB.Connection")
    >
    > Conn.Open = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    > "Data Source=" & Server.MapPath("..\db\business.mdb")
    >
    > Set rsProd = Server.CreateObject("ADODB.Recordset")
    > strSQL = "SELECT * FROM offers " & "WHERE ServID = " &
    > Request.QueryString("catID") & " " & "ORDER BY Description"
    > Set rsProd = Conn.Execute(strSQL)
    > %>
    > <body>
    >
    > <ul>
    > <%
    > Do While Not rsProd.EOF
    > Response.Write rsProd("Description")
    >
    >
    > rsProd.Movenext
    > Loop
    > %>
    >
    > <%
    > rsProd.Close
    > Conn.Close
    > %>
    >
    >
    >
     
    =?Utf-8?B?SXZhbiBLLg==?=, Oct 10, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Patrick
    Replies:
    1
    Views:
    533
    =?Utf-8?B?RG90TmV0SmVyb21l?=
    Feb 24, 2005
  2. Mehdi
    Replies:
    6
    Views:
    36,213
    sloan
    Apr 6, 2006
  3. =?Utf-8?B?TWlrZQ==?=

    Querystring Issue - ASP.NET within ASP site's IFRAME

    =?Utf-8?B?TWlrZQ==?=, Jul 12, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    802
    =?Utf-8?B?TWlrZQ==?=
    Jul 12, 2007
  4. Alex
    Replies:
    2
    Views:
    1,478
  5. Adeel Ahmad
    Replies:
    1
    Views:
    576
    Anthony Jones
    Mar 7, 2006
Loading...

Share This Page