If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Passing parameters to stored procedure using ASP

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-11-03, 17:28
tjacobs tjacobs is offline
Registered User
 
Join Date: Oct 2002
Location: Greensboro, NC
Posts: 50
Angry 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
Reply With Quote
  #2 (permalink)  
Old 08-13-03, 01:11
Memnoch1207 Memnoch1207 is offline
Registered User
 
Join Date: Jan 2003
Location: Midwest
Posts: 138
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On