Sunday, February 12, 2012

can not retrive @@identity value

I use select @.@.identity to return @.@.identity from my store procedure,
but I could not retrive it from my Visual basic code, like variable=
oRS.fields.item(0).value, it always says item can not be found...Hi

At a guess it is probably because it is not the first recordset being
returned.

Instead it may be best to use an output parameter to do this.

Also if you are using SQL 2000 then use the SCOPE_IDENTITY() function.

John

"Allan" <hlang121@.yahoo.com> wrote in message
news:436e7a2d.0308271236.3bd2edd2@.posting.google.c om...
> I use select @.@.identity to return @.@.identity from my store procedure,
> but I could not retrive it from my Visual basic code, like variable=
> oRS.fields.item(0).value, it always says item can not be found...|||Allan (hlang121@.yahoo.com) writes:
> I use select @.@.identity to return @.@.identity from my store procedure,
> but I could not retrive it from my Visual basic code, like variable=
> oRS.fields.item(0).value, it always says item can not be found...

So how does the VB code look like? And how does the stored procedure
look like?

Your chances to precise assistance increases if you care to share
the code you are having problem.
--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Hi,

One of the easiest way to get the identity value from sqlserver7.0, is

rs.open"select @.@.identity as id from tab1",..,..
box1 = rs!id

With Thanks
Raghu

No comments:

Post a Comment