Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing a Paramter to a Oracle Stored Procedure

Status
Not open for further replies.

towser

Programmer
Feb 19, 2001
29
GB
The below ASP page should pass a string to a Oracle stored preocdure then using the returned recordset display the data using paging, simple. The IN_SQL string would be built up by a user selection but whilst I'm developing it's hardcoded in the ASP page.

I am getting a syntax error in {call...} ODBC ESCAPE on the line that opens the recordset.

Can anyone assist please ?

<%@ LANGUAGE=&quot;VBSCRIPT&quot; %>
<% Option Explicit %>
<!-- #include file=&quot;ADOVBS.INC&quot; -->
<%

Dim IN_SQL
'Set how many records per page we want
Const NumPerPage = 5

'Retrieve what page we're currently on
Dim CurPage
If Request.QueryString(&quot;CurPage&quot;) = &quot;&quot; then
CurPage = 1 'We're on the first page
Else
CurPage = Request.QueryString(&quot;CurPage&quot;)
End If

Dim conn
Dim strconnection
strconnection = &quot;Provider=MSDAORA.1;Password=reading;User ID=s27287;Data Source=trackdev&quot;

Set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.Open strconnection

'Explicitly Create a recordset object
Dim rs
Set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)

'Set the cursor location property
rs.CursorLocation = adUseclient

'Set the cache size = to the # of records/page
rs.CacheSize = NumPerPage

'Open our recordset
Dim strSQL
IN_SQL = &quot;select claim_number, client_number from summaries&quot;
strSQL= &quot;PACKAGE_name.PROCEDURE_name&quot; & IN_SQL

rs.Open strSQL, Conn, adOpenKeyset, adLockReadOnly, adCmdStoredProc

rs.MoveFirst
rs.PageSize = NumPerPage

'Get the max number of pages
Dim TotalPages
TotalPages = rs.PageCount

'Set the absolute page
rs.AbsolutePage = CurPage

'Counting variable for our recordset
Dim count
%>

<HTML>
<BODY>
<BR>
<table border=1 bgcolor=lightblue>
<tr>
<th> claim_number </th> <th> client_number </th>
</tr>

<%
'Set Count equal to zero
Count = 0
Do While Not rs.EOF And Count < rs.PageSize
%> <tr><td><%
Response.Write(rs(&quot;claim_number&quot;)) %> </td><td> <% Response.Write(rs(&quot;client_number&quot;)) %> </td></tr><%
Count = Count + 1
rs.MoveNext
Loop
%></table><%
'Print out the current page # / total pages
Response.Write(&quot;Page &quot; & CurPage & &quot; of &quot; & TotalPages & &quot;<P>&quot;)

'Display Next / Prev buttons
if CurPage > 1 then
'We are not at the beginning, show the prev button
Response.Write(&quot;<INPUT TYPE=BUTTON VALUE=PREV ONCLICK=&quot;&quot;document.location.href='paging.asp?curpage=&quot; & curpage - 1 & &quot;';&quot;&quot;>&quot;)
End If

if CInt(CurPage) <> CInt(TotalPages) then
'We are not at the end, show a next button
Response.Write(&quot;<INPUT TYPE=BUTTON VALUE=NEXT ONCLICK=&quot;&quot;document.location.href='paging.asp?curpage=&quot; & curpage + 1 & &quot;';&quot;&quot;>&quot;)
End If

%>

</BODY>
</HTML>





 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top