473,398 Members | 2,403 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,398 software developers and data experts.

asp.net +VB: get autonumber id

hello guys
I'm a novice for Asp.net, since now I've always used asp

I need to insert a record in an access database and get the last id of an
autonumber field

Can you please help me?
thanks
Nov 22 '05 #1
3 1568
Denis,

This is not an easy to answer question, maybe you can have a look what is
written in the newsgroup adonet for that.

I did a search for you.
http://tinyurl.com/6fa25

I hope this helps?

Cor

"denis" <de***@discussions.microsoft.com>
hello guys
I'm a novice for Asp.net, since now I've always used asp

I need to insert a record in an access database and get the last id of an
autonumber field

Can you please help me?
thanks

Nov 22 '05 #2
The easiest way is to insert a unique value into the table along with the
record your storing, and then do a select to get the ID based on that unique
value as the where part of the query. DataTime TickCount is normally a
suitable value.

Its two calls as opposed to one, but its a very easy to implement solution.

--
Regards

John Timney
ASP.NET MVP

"denis" <de***@discussions.microsoft.com> wrote in message
news:F1**********************************@microsof t.com...
hello guys
I'm a novice for Asp.net, since now I've always used asp

I need to insert a record in an access database and get the last id of an
autonumber field

Can you please help me?
thanks

Nov 22 '05 #3
Dennis,

I saw yesterday (long after that I had answered your question) that there
are now nice SQL pages on MSDN.

Your question.

http://msdn.microsoft.com/library/de...obals_50u1.asp

I hope this helps?

Cor

"denis" <de***@discussions.microsoft.com>
hello guys
I'm a novice for Asp.net, since now I've always used asp

I need to insert a record in an access database and get the last id of an
autonumber field

Can you please help me?
thanks

Nov 22 '05 #4

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

Similar topics

2
by: DLenee | last post by:
I am trying to create a parameterized query and it keeps giving me an error "Datatype error in expression" when I enter = @ChildID or =?ChildID. The ? is supposed to be the wildcard for Access...
33
by: Lee C. | last post by:
I'm finding this to be extremely difficult to set up. I understand that Access won't manage the primary key and the cascade updates for a table. Fine. I tried changing the PK type to number and...
35
by: Traci | last post by:
If I have a table with an autonumber primary key and 100 records and I delete the last 50 records, the next record added would have a primary key of 101. Is there any way to have the primary key...
26
by: jimfortune | last post by:
Sometimes I use Autonumber fields for ID fields. Furthermore, sometimes I use those same fields in orderdetail type tables. So it's important in that case that once an autonumber key value is...
7
by: Cindy H | last post by:
Hi I'm having a problem getting the insert statement correct for an Access table I'm using. The Access table uses an autonumber for the primary key. I have tried this: INSERT INTO Tournaments...
11
by: Alan Mailer | last post by:
A project I'm working on is going to use VB6 as a front end. The back end is going to be pre-existing MS Access 2002 database tables which already have records in them *but do not have any...
3
by: Andy_Khosravi | last post by:
I'm having a problem with an entry form on one of my applications. It would appear that the save action is sometimes not working, and is generating no error when it fails. I'm hoping one of you may...
5
by: KPR1977 | last post by:
Does anybody know a VB code that would populate the "AutoNumber" field each time it is run for my "Transpo" table in the manner depicted below? I need the AutoNumber field to reset at the...
1
by: cellus205 | last post by:
Hey everyone, Im using VB .NET 08 and am having trouble resetting the autonumber seed when I clear the database. I know in access to reset the seed u can do a compact and repair, but Im not sure how...
1
by: sanju4kk | last post by:
I am attempting to create a module that I can call to create a new field in my temp table that will be an autonumber, and then assigned that new field as the primary key. I have been search high and...
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...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.