Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Passing querystring to storedproc
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

snaayk
Senior Member

USA
1061 Posts

Posted - 25 March 2002 :  16:55:46  Show Profile  Visit snaayk's Homepage  Send snaayk an AOL message  Send snaayk an ICQ Message  Send snaayk a Yahoo! Message
I am using the following code for a storedproc. If I hardcode the value it runs fine, however, what would be the correct syntax to pass a value from the querysting

 
<% Response.buffer = true

sdate = Request.Querystring("sdate")
edate = Request.Querystring("edate")
rmonth = Request.Querystring("rmonth")
rc = Request.Querystring("rc")

%>
<html>
<head>
<title>Running Stored Queries in Access Database</title>
<style>p { font-family:verdana,arial; font-size:10pt;
font-weight:bold; }</style>
</head>
<body><p>
<%
' Connection String
' Provide relative path to your StoredProc.mdb
' database

Dim connStr
connStr = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=d:\inetpub\realmslore\www\upload\performance.mdb"

' Connection Object
Dim con
Set con = Server.CreateObject("ADODB.Connection")

' Recordset Object
Dim rs

' connecting to database
con.Open connStr

' executing stored procedure
Set rs = con.Execute ("exec tech '03012002' , '03092002' , 'ns410803' , '2' ")
'





set f_name = rs("f_name")
set l_name = rs("l_name")
set tot_hrs = rs("total_hrs")
set tot_ot = rs("total_ot")
set tot_comp = rs("total_comp")
set tot_tasks = rs("total_tasks")
set revisit = rs("revisit")

%>
<%= rc %>
<table width="100%">
<tr>
<td>Name</td>
<td>Total Hours</td>
<td>Total OT</td>
<td>Completes</td>
<td>Totals Tasks</td>
<td>HPD</td>
<td>DE</td>
<td>Revisit</td>
<td>ITP</td>
<td>QJPD</td>
</tr>

<%
While Not rs.EOF
%>


<tr>
<td><%= f_name %> <%= l_name %></td>
<td><%= tot_hrs %></td>
<td><%= tot_ot %></td>
<td><%= tot_comp %></td>
<td><%= tot_tasks %></td>
<td><%= FormatNumber(tot_hrs/tot_tasks, 2, -1, -1) %></td>
<td><%= FormatPercent(tot_comp/tot_tasks,-1, -1, -1) %></td>
<td><%= FormatPercent(revisit, 2, -1, -1) %></td>
<td><%= FormatNumber((tot_hrs/tot_tasks)/(tot_comp/tot_tasks*(1-revisit)), 2, -1, -1) %></td>
<td><%= FormatNumber(8/((tot_hrs/tot_tasks)/(tot_comp/tot_tasks*(1-revisit))), 2, -1, -1) %></td>
</tr>



I wanted to replace the values in RED with something like & rc & but I can't find the correct syntax...can it even be done in a stored proc????

em_
Starting Member

23 Posts

Posted - 25 March 2002 :  17:24:47  Show Profile
I think you need to move the variable assignments:

sdate = Request.Querystring("sdate")
edate = Request.Querystring("edate")
rmonth = Request.Querystring("rmonth")
rc = Request.Querystring("rc")

into the lower section where you are referencing them. That works for me.

Then use:
Set rs = con.Execute ("exec tech" & var1 & "," & "'"& var2 & "'," ....etc)


Or you might explicitly DIM them which would give them script scope.

$.02
Em.




Edited by - em_ on 25 March 2002 17:27:01
Go to Top of Page

snaayk
Senior Member

USA
1061 Posts

Posted - 26 March 2002 :  16:29:48  Show Profile  Visit snaayk's Homepage  Send snaayk an AOL message  Send snaayk an ICQ Message  Send snaayk a Yahoo! Message
I can't believe I forgot that The minute I saw your post I noticed I had forgotten to place the " before the & ...

Thanks for the reminder it's working now.

Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.28 seconds. Powered By: Snitz Forums 2000 Version 3.4.07