473,473 Members | 2,025 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 1570
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.