473,385 Members | 1,588 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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....
Jul 20 '05 #1
3 2738
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" <hl******@yahoo.com> wrote in message
news:43**************************@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....

Jul 20 '05 #2
Allan (hl******@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, so****@algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Jul 20 '05 #3
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
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Paul | last post by:
Dear All, How should I do if I want to get the identity value after insert a new record from Access? Thanks !! -- Paul
1
by: dusty | last post by:
Hi, I'll try to simplify the problem: I created a table "TestTable" in a database on the SQL server. The first column, 'id', is the primary key with a auto-increment identity. I want to work...
0
by: Kartic | last post by:
When I do this using UnStrongly Type, Everything works fine. I get the Identity value Private Sub formUnit_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ...
2
by: Wayne Wengert | last post by:
I have a VB.NET app in which I am using the following code to add a new row. ds.Tables("UnitsTable").Rows.Add(dr) ' Add the new row da.InsertCommand = cmdBuilder.GetInsertCommand da.Update(ds,...
8
by: Doru Roman | last post by:
Hi, I insert a new record with a command: private SqlCommand comInsert; comInsert = conDataBase.CreateCommand(); comInsert.CommandType = CommandType.Text;
3
by: Susanne Klemm | last post by:
Hello! I use a procedure to insert a new row into a table with an identity column. The procedure has an output parameter which gives me the inserted identity value. This worked well for a long...
0
by: saktiranjan | last post by:
Hi, I wish to check how many times a identity value has been reset and when & by whom? its very urgent... can anybody help me Sakti saktiranjan@gmail.com
15
by: gunnar.sigurjonsson | last post by:
I´m having some problem retrieving identity value from my newly inserted row into a view. I have two tables T1 and T2 which I define as following CREATE TABLE T1 ( id BIGINT GENERATED ALWAYS...
10
by: arial | last post by:
Hi all, I need some help on retrive the value from query string. I have two web forms. One has the datagridview which displays the data from database. On one of the column I made a hyperlink to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.