Re: Tricky Stored Procedure Problem - for SQL Experts only!
From: Andy (aon14_at_lycos.co.uk)
Date: 03/19/04
- Next message: Andy: "Re: Database design question"
- Previous message: Andy: "Re: Job scheduling"
- In reply to: John Hoge: "Tricky Stored Procedure Problem - for SQL Experts only!"
- Next in thread: John Hoge: "Re: Tricky Stored Procedure Problem - for SQL Experts only!"
- Reply: John Hoge: "Re: Tricky Stored Procedure Problem - for SQL Experts only!"
- Messages sorted by: [ date ] [ thread ]
Date: 19 Mar 2004 06:05:57 -0800
jhoge123@yahoo.com (John Hoge) wrote in message news:<d0f2d316.0403130607.3d826b5a@posting.google.com>...
> In a web application I need to call a stored procedure that lists
> items in a shopping cart. The Sproc is pretty complicated as it needs
> to do compatibility checks between the items in the cart, and makes
> use of temporary tables. It has one parameter, the order ID.
>
> The problem lies when the recorset needs to be opened in any
> non-forward only mode, such as static, dynamic or keyset. This is
> needed because the checkout page contains script to compose an email,
> so the recordset needs to be looped through twice.
>
> It seems the recordset.moveFirst command will cause this error
>
> Microsoft OLE DB Provider for ODBC Drivers error '80040e18'
> Rowset position cannot be restarted.
>
> in any situation where a stored procecure including a temporary table
> is called, and a parameter is passed. Take a look at the Sproc below:
>
> create proc usp_test(@id int) as
> select @@version as version into #test
> select * from #test
>
> Pretty simple. It makes a temp table and spits it out. When called by
> the vbscript code below, it produces the above error. I've tried this
> both on SQL7 and SQL2000.
>
> set ordItemsRS = server.createObject("ADODB.RECORDSET")
> with cmdorderItems
> .activeConnection = "DSN=SeaEagle"
> .commandType = adCmdStoredProc
> .Commandtext = "usp_test"
> .Parameters.Append .CreateParameter("@ord_id",adInteger,adParamInput,,25075)
> end with
>
> ordItemsRS.open cmdOrderItems, ,adOpenStatic ,adLockReadOnly
>
> do while not ordItemsRS.eof
> response.write ordItemsRS("version") & "<br>"
> ordItemsRS.moveNext
> loop
>
> ordItemsRS.moveFIrst
Can you moveprevious?
- Next message: Andy: "Re: Database design question"
- Previous message: Andy: "Re: Job scheduling"
- In reply to: John Hoge: "Tricky Stored Procedure Problem - for SQL Experts only!"
- Next in thread: John Hoge: "Re: Tricky Stored Procedure Problem - for SQL Experts only!"
- Reply: John Hoge: "Re: Tricky Stored Procedure Problem - for SQL Experts only!"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|