Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 24th, 2004, 09:02 AM
matt12511's Avatar
matt12511 matt12511 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 36 matt12511 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 m 15 sec
Reputation Power: 5
@@Identity - problem getting data back

Hi,

I have some asp that should be inserting a shopper into my SQL Server DB.

Code:
' call a stored procedure to create a new shopper
sql = "execute sp_InsertShopper" 
set rsShopper = dbShopper.execute(sql) 
session("idShopper") = rsShopper("idShopper")


And here is the Code for sp_InsertShopper:

Code:
/* Utilized to insert a new shopper into the database */
 
Create Procedure sp_InsertShopper 
 
AS
 
insert into shopper(chrUserName, chrPassword) values('','')
 
select idShopper = @@identity


I checked the DB and the shopper is being created but the session is not storing the ID.

Any Ideas?

Matt

Reply With Quote
  #2  
Old November 24th, 2004, 09:19 AM
matt12511's Avatar
matt12511 matt12511 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 36 matt12511 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 m 15 sec
Reputation Power: 5
Oh the shame...

I asked this question before:

Here is the answer:

You donīt have to create an Output parameter unless you want to call this from another Stored Procedure.

Try using this stored procedure:

Create Procedure sp_CreateBasket
@idShopper int

AS
Set nocount on
Insert into basket(idShopper) values(@idShopper)
Select @@identity as idBasket

Simon

(I thought it sounded like a familiar problem)

Matt

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > @@Identity - problem getting data back


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway