473,385 Members | 1,468 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.

How to retrieve the IDENTITY from an inserted record.

The following example works, but the retrival of the returned identity does not work

'Set Command Object Propertie
objCommand.ActiveConnection = GV_objConnectio
objCommand.CommandText = "DAO.RCCBABY_Add_Test
objCommand.CommandType = ADODB.CommandTypeEnum.adCmdStoredPro

'Set The Parameter
objCommand.Parameters.Append(objCommand.CreatePara meter("TestKey", ADODB.DataTypeEnum.adInteger, ADODB.ParameterDirectionEnum.adParamReturnValue)
objCommand.Parameters.Append(objCommand.CreatePara meter("Test1", ADODB.DataTypeEnum.adVarChar, ADODB.ParameterDirectionEnum.adParamInput, 10, TextBox1.Text)
objCommand.Parameters.Append(objCommand.CreatePara meter("Test2", ADODB.DataTypeEnum.adVarChar, ADODB.ParameterDirectionEnum.adParamInput, 10, TextBox2.Text)
objCommand.Parameters.Append(objCommand.CreatePara meter("Test3", ADODB.DataTypeEnum.adVarChar, ADODB.ParameterDirectionEnum.adParamInput, 10, TextBox3.Text)

'Execute the comman
objCommand.Execute(

RetrievedData = objCommand.Parameters("TestKey").Value -----> THIS INSTRUCTIONS DOES NOT WORK, RETURN NOTHIN

This is the stored procedure

CREATE PROCEDURE ADO.RCCBABY_Add_Test (@Test1 VarChar (10)
@Test2 VarChar (10)
@Test3 VarChar (10)) A
begin transactio
begi
INSERT INTO Tes
(Test1
Test2
Test3
VALUE
(@Test1
@Test2
@Test3
en
commi

return @@identity -----> NOTE THIS IS RETURNNING THE IDENTIT
GO
Nov 22 '05 #1
2 1682
JW
I use this and it works good for us

com.ExecuteScalar ( );
Nov 22 '05 #2
JW
I use this and it works good for us

com.ExecuteScalar ( );
Nov 22 '05 #3

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

Similar topics

4
by: Carlos San Miguel | last post by:
Hi, I'm going to be using Oracle with a customer. I will access Oracle with ODBC. All the tables have an Identity column, this is the ID for the record. I need to know how I can get the value of...
1
by: Alberto | last post by:
The following example works, but the retrival of the returned identity does not work 'Set Command Object Propertie objCommand.ActiveConnection = GV_objConnectio objCommand.CommandText =...
6
by: Who.Really.Really.Cares | last post by:
Hi! I guess this must be a FAQ but I'll give it a try. I've searched the web and usenet archive and found only negative answers. But most of them were dated like 3-4 years back. Hasn't anything...
17
by: Trevor Best | last post by:
I don't know if this has been reported before but it appears to be a bug with Access. If I create two tables both with an identity column then create an insert trigger on table1 that inserts a...
2
by: WhiteEagl | last post by:
Hello, I would need some help with this identity column problem in SQLServer. I have a database with two tables. The Parent table has an Identity column. Parent (ParentID IDENTITY, Name)...
9
by: Micheal | last post by:
How do I get the @@identity value without using stored procedures in C#? I have the a table named 'sports' that has an @@identity value for the primary key. What I want to do is after I insert...
3
by: Dan | last post by:
I'm writing a record from an asp.net page to SQL Server. After the insert I'm selecting @@identity to return the ID of the record that I just wrote. It worked fine until I typed a semicolon into...
3
by: Jason L James | last post by:
Hi all, I recently wrote a vb.net app using oledb to an access database. When I inserted new rows in my datatable the identity column was automatically created. This app used an un-typed...
1
by: Craig | last post by:
In ASP.NET 2.0 and the formview control how do you get the value of the identity field of a newly inserted record? In ASP.NET 1.1 after the new record was saved you just said intNewIdentityID =...
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;
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.