Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old September 9th, 2008, 02:58 PM
Authorized User
 
Join Date: Mar 2006
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default Pass XML parameter to stored procedure

I'm trying to pass an XML parameter to a stored procedure. I had it working using the command object, but since the recordcount and pagecount refuse to work with the command object I had to switch to the connection object.

How can I pass an XML parameter to my stored procedure? Here is what I was using for the command object:

Code:
sXMLDoc = oXmlDom.selectSingleNode("/").xml
oCmd.Parameters.Append oCmd.CreateParameter("", adVarchar, adParamInput, Len(sXMLDoc), sXMLDoc)
The above worked for me, however there can be several thousands of rows returned, and the rest of the code only displays 250 records on the screen at a time so the recordcount and pagecount are needed.

Your help is appreciated.

Thanks

  #2 (permalink)  
Old September 9th, 2008, 06:12 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

So if that works for you, what's the point of your question???

If all you are trying to do is get the recordcount and pagecount, that has nothing at all to do with whether you used the value from XML or just used any old value.

It's all a matter of how you open the recordset. And you don't show that code.

*PROBABLY* what you need to do, after the code you show, is something like:

Code:
<%
...
Set RS = Server.CreateObject("ADODB.Recordset")
RS.PageSize = 10 ' or whatever size you want
RS.Open oCmd, ,3

recordCount = RS.recordCount
pageCount = RS.pageCount
...
%>
  #3 (permalink)  
Old September 10th, 2008, 08:38 AM
Authorized User
 
Join Date: Mar 2006
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found where my issue was. I didn't have single quotes around the xml parameter when using the recordset to open.

Thanks.
  #4 (permalink)  
Old September 10th, 2008, 02:07 PM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

How strange!??!!

YOu shouldn't need apostrophes around a value used with a command parameter, as in your code

oCmd.Parameters.Append oCmd.CreateParameter("", adVarchar, adParamInput, Len(sXMLDoc), sXMLDoc)

Are you saying you changed the way of opening the recordset??

Oh, well. Glad you got it working.


Similar Threads
Thread Thread Starter Forum Replies Last Post
pass null to the parameter in the stored procedure kokila BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 0 July 12th, 2007 03:02 AM
how to pass value to stored procedure? hertendreef SQL Server 2005 3 February 23rd, 2007 11:43 AM
How to pass a parameter to a stored procedure? MaxGay2 VB.NET 2002/2003 Basics 1 November 8th, 2006 02:48 PM
Pass an Array as a Parameter to a Stored Procedure booksnore2 Oracle 0 August 31st, 2004 09:20 AM
How will I pass stored procedure in an asp shoakat SQL Server 2000 1 July 15th, 2004 10:28 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.