Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2002
    Location
    Greensboro, NC
    Posts
    50

    Angry Unanswered: Passing parameters to stored procedure using ASP

    Hello Everyone,

    I am in desperate need of help. I am trying to pass parameters to a stored procedure on SQL server but I am not having any kind of success. Here is the code that I'm using on my web and following is the stored procedure i'm using sql server.

    TIA

    tjacobs
    <%
    dim conn
    dim rs
    dim strsql
    dim strconn
    dim strZipCode
    strZipcode = request("zipcode")
    strconn="driver={sql server};server=servername;uid=;pwd=;database=name"
    set conn = server.createobject("adodb.connection")
    conn.open strconn
    strsql = "exec zipcodelatlon" & strzipcode
    set rs=server.createobject("adodb.recordset")
    rs.open strsql, conn
    rs.movefirst
    %>

    <html>

    <head>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>TestLatLon</title>
    </head>

    <body>
    <% do while not rs.eof %>
    <tr><%for each field in rs.fields %.
    <td allign=center>
    <% response.write field.value %></td>
    <% next rs.movenext %>
    </tr>
    <% loop %>
    </table>
    </body>
    <% rs.close
    set rs.nothing
    conn.close
    set conn = nothing %>

    </html>



    Stored Procedure

    CREATE PROCEDURE ZIPCODELATLON
    (@zipcode1 int)
    as
    select lat, lon as lat1, lon1 from uscityzip
    where zipcode = @zipcode
    return
    go

  2. #2
    Join Date
    Jan 2003
    Location
    Midwest
    Posts
    138

Posting Permissions

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