Ask a Question related to ASP Database, Design and Development.
-
Re: Frustrating Stored Procedure Prob
Try putting:
set nocount on
at the beginning of the stored procedure.
"Andrew Paton" <andrew.paton@nospamplease.nufsaid.net> a écrit dans le message de news: [email]eYthI2MQDHA.3768@tk2msftngp13.phx.gbl[/email]...> I have the Simple Stored Procedure:
>
> CREATE PROCEDURE dbo.spCreateCart
> AS
> BEGIN
> INSERT tblCart
> VALUES (getdate())
> SELECT @@IDENTITY as cartID
> END
> GO
>
> When i run this in stored procedure it works fine, i get my record created
> and it returns the field i want under the alias 'cartID'
>
> However when i try to grab this value using the following ASP i get an 'Item
> cannot be found in the collection corresponding to the requested name or
> ordinal.' Error.
>
> SQL = "EXEC dbo.spCreateCart"
> rsCreateCart = conn.execute(SQL)
>
> cartID = rsCreateCart("cartID")
> response.write cartID
>
> I know that my connection is fine - since it works with other sections of
> the script. And i have checked field names etc. This one really has me
> stumped. Does anyone have any ideas?
>
> Thankyou
>
>
>Guest
-
Stored Procedure
EXEC master..xp_cmdshell 'cscript c:\path\file.vbs' EXEC master..xp_cmdshell 'c:\path\file.exe' "Kannan" <gk_i@yahoo.com> wrote in message... -
stored procedure help
Hi all! I am in need of writing a few stored procedures. The first one is to create a stored procedure to recover a database from backup and the... -
Using a stored procedure
I am trying to pass a ProdID to a stored procedure, but I get an error: Error Executing Database Query. Procedure 'PriceBreak' expects... -
stored procedure value
How can I bind a stored procedure value to a page? I've executed a stored procedure and there should be two column values created...i.e. col1 and... -
need help on a stored procedure
I have 2 tables. table1 and table2 I do a select on table1 and join table 2 on id. I want to check newprice in table1. if it is null, I want to... -
Re: Frustrating Stored Procedure Prob
Try putting:
set nocount on
at the beginning of the stored procedure.
"Andrew Paton" <andrew.paton@nospamplease.nufsaid.net> a écrit dans le message de news: [email]eYthI2MQDHA.3768@tk2msftngp13.phx.gbl[/email]...> I have the Simple Stored Procedure:
>
> CREATE PROCEDURE dbo.spCreateCart
> AS
> BEGIN
> INSERT tblCart
> VALUES (getdate())
> SELECT @@IDENTITY as cartID
> END
> GO
>
> When i run this in stored procedure it works fine, i get my record created
> and it returns the field i want under the alias 'cartID'
>
> However when i try to grab this value using the following ASP i get an 'Item
> cannot be found in the collection corresponding to the requested name or
> ordinal.' Error.
>
> SQL = "EXEC dbo.spCreateCart"
> rsCreateCart = conn.execute(SQL)
>
> cartID = rsCreateCart("cartID")
> response.write cartID
>
> I know that my connection is fine - since it works with other sections of
> the script. And i have checked field names etc. This one really has me
> stumped. Does anyone have any ideas?
>
> Thankyou
>
>
>Guest
-
Robb Meade #3
Re: Frustrating Stored Procedure Prob
"Andrew Paton" wrote ...
'Item> However when i try to grab this value using the following ASP i get anTry collecting the value in your ASP like this...> cannot be found in the collection corresponding to the requested name or
> ordinal.' Error.
strCartID = RS(0)
See if that works :)
Robb
Robb Meade Guest
-
Robb Meade #4
Re: Frustrating Stored Procedure Prob
"Andrew Paton" wrote ...
'Item> However when i try to grab this value using the following ASP i get anTry collecting the value in your ASP like this...> cannot be found in the collection corresponding to the requested name or
> ordinal.' Error.
strCartID = RS(0)
See if that works :)
Robb
Robb Meade Guest
-
Re: Frustrating Stored Procedure Prob
From BOL:
Each INSERT, UPDATE, and DELETE statement returns a result set containing only the number of rows affected by the modification...
When the NOCOUNT option is set on, SQL Server does not return the counts of the rows affected by a statement.
It is good practice to always include 'set nocount on' in all INSERT, UPDATE, and DELETE procedures, unless you really want to return Rowcount to the client. This also boosts performance.
If you do not include it, you have to use:
"set rsCreateCart = rsCreateCart.nextrecordset"
in your ASP page to access "cartID".
"Andrew Paton" <andrew.paton@nospamplease.nufsaid.net> a écrit dans le message de news: e2p5U$MQDHA.3016@TK2MSFTNGP10.phx.gbl...>> >Try putting:
> >set nocount on
> Thankyou this worked a treat - can i ask what difference setting no count on
> makes?
>
>
>Guest
-
Re: Frustrating Stored Procedure Prob
From BOL:
Each INSERT, UPDATE, and DELETE statement returns a result set containing only the number of rows affected by the modification...
When the NOCOUNT option is set on, SQL Server does not return the counts of the rows affected by a statement.
It is good practice to always include 'set nocount on' in all INSERT, UPDATE, and DELETE procedures, unless you really want to return Rowcount to the client. This also boosts performance.
If you do not include it, you have to use:
"set rsCreateCart = rsCreateCart.nextrecordset"
in your ASP page to access "cartID".
"Andrew Paton" <andrew.paton@nospamplease.nufsaid.net> a écrit dans le message de news: e2p5U$MQDHA.3016@TK2MSFTNGP10.phx.gbl...>> >Try putting:
> >set nocount on
> Thankyou this worked a treat - can i ask what difference setting no count on
> makes?
>
>
>Guest



Reply With Quote

