473,466 Members | 1,619 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Multi access in SQL Server

ByB
Hello,

I am working on an Access VBA application, working in client/server
mode, with a shared SQL Server base.

I have to INSERT some data in the base, and the know what is the ID
that SQL Server associated with my data in the table. So I need to do
the following

INSERT data INTO TABLE
SELECT MAX ID FROM TABLE (to get the ID)

but since I am working in client/server, if some DATA has been inserted
by another client after my INSERT, then MAX ID is not the convenient
ID of my data ...

Is there a way for me to get the ID when I do the INSERT, or to
lock/unlock the table before the INSERT and after the SELECT ?

Thank you for any hint about that.

--
L'ordinateur peut faire plus de calculs que le cerveau de l'homme car
il n'a que ça à faire
Jun 17 '07 #1
1 1718
ByB (em***@email.com) writes:
I am working on an Access VBA application, working in client/server
mode, with a shared SQL Server base.

I have to INSERT some data in the base, and the know what is the ID
that SQL Server associated with my data in the table. So I need to do
the following

INSERT data INTO TABLE
SELECT MAX ID FROM TABLE (to get the ID)

but since I am working in client/server, if some DATA has been inserted
by another client after my INSERT, then MAX ID is not the convenient
ID of my data ...

Is there a way for me to get the ID when I do the INSERT, or to
lock/unlock the table before the INSERT and after the SELECT ?
It sounds like your table has the IDENTITY property. In such case, use
the function scope_identity() to retrieve last generated ID value.

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jun 17 '07 #2

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

Similar topics

4
by: bher2 | last post by:
good day... im working right now on a project given to me on a short time. i had a slight problem though, but it seems that most of it comes on my database. since theres not enought budget on...
3
by: canigou9 (remove your socks to reply) | last post by:
(cross posted - comp.databases.ms-access, microsoft.public.access) Hello folks - this is my first post here, after a short lurk. I have written an application in Access2002 for a friend's...
2
by: RipTide | last post by:
Background: Using an unsupported/abandoned multi-user multi-database program that uses Access 97 and Jet 3.5. Program itself appears to have been built with PowerBuilder 6.5. Databases reside on...
2
by: Scott Bryce | last post by:
I am creating a CGI application in Perl that uses an Access database. It will be hosted on an NT server. I have used flat file DBMs (tied hashes) on UNIX servers, but I am not familiar with how...
2
by: Deano | last post by:
One of the more challenging things on my app's wishlist is to make it multi-user on a LAN. For the record my app was always intended to a single-user but things have changed. It's mostly...
5
by: premmehrotra | last post by:
I currently have a multi-user access database which is put on a shared drive L: on a Windows Servers. Entire database is one file premdb.mdb. Users access this database from their laptops....
10
by: Deano | last post by:
Hi, I feel I have a good learning opportunity here. I have been asked to knock up a simple db for managing lettings of rooms and halls. I'm confident about the design but want to make it...
5
by: bobwansink | last post by:
Hi, I'm relatively new to programming and I would like to create a C++ multi user program. It's for a project for school. This means I will have to write a paper about the theory too. Does anyone...
45
by: Luvin lunch | last post by:
Hi, I'm new to Access and have been asked to develop a simple Access system to replace one that already exists. There are five users of the current Access system and each of the users works off...
31
by: zdenko | last post by:
I have a multi user database and users were created by user level security wizzard - as I mentioned in message before. Everything works fine for those users, but now I have another problem. I have...
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
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
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...
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: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
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 ...

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.