Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: Inserting record with Microsoft Access

Reply
Thread Tools

Re: Inserting record with Microsoft Access

 
 
Albert Leibbrandt
Guest
Posts: n/a
 
      02-09-2006


jeffhg582003 wrote:

>Hi,
>
>I am developing a python script which add records to
>a microsoft access tables. All my tables have autogenerated number
>fields. I am trying to capture the number generated from the insert but
>I am not exactly sure how to do that after an insert.
>
>Thanks,
>Jeff
>
>
>
>
>

I had to do something similiar in sql server and the experts back then
told me that the only way is to write a stored procedure. aparently sql
server does not have sequences and I am guessing that access is the same.

cheers
albert

--
Albert Leibbrandt
Data Manager
CompuScan Holdings (Pty) Ltd
Brandwacht Office Park
Stellenbosch.
South Africa.
Tel;+27 (0)21-8886000
Fax;+27 (0)21-8832336
National: 0861 51 41 31
E-Mail : http://www.velocityreviews.com/forums/(E-Mail Removed)

www.compuscan.co.za - reducing credit risk and fraud, at the same time protecting the consumer against over-indebtedness and reckless borrowing

www.techtonic.co.za - a software design and development, information management and internet solutions company

www.csti.co.za - a skills training and development provider to the Micro Finance sector (BANKSETA accredited)

Confidentiality:
"The information contained in this e-mail and any attachments thereto is private and confidential and is intended for the eyes of the addressees only. Access to this e-mail by any other person or any attachment is not authorized and accordingly prohibited. If you are not the authorized and intended recipient, any disclosure, copying, dissemination or distribution, any other action of omission by you with respect to the information in this e-mail and attachments is prohibited and unlawful."

 
Reply With Quote
 
 
 
 
Dennis Lee Bieber
Guest
Posts: n/a
 
      02-09-2006
On Thu, 09 Feb 2006 10:54:45 +0200, Albert Leibbrandt
<(E-Mail Removed)> declaimed the following in comp.lang.python:

> told me that the only way is to write a stored procedure. aparently sql
> server does not have sequences and I am guessing that access is the same.
>

Access/JET does have an autonumber field type... Obtaining the last
inserted value is a different matter -- I don't have time to crawl
through the half-dozen VB-JET/Access database texts I have lying around,
but I'm sure an algorithm was given for this (short of locking the
tables during the insert and then doing something like select
max(autonumber_field) from insert_table; lock needed to prevent a
concurrent insert changing the number)

From O-XP help, mapping between the two (unfortunately, it doesn't go
into details on the SQL Server types, so what the "identity property"
defines is unknown:

JET
AutoNumber (AutoNumber data type: In a Microsoft Access database, a
field data type that automatically stores a unique number for each
record as it's added to a table. Three kinds of numbers can be
generated: sequential, random, and Replication ID.) (Increment)

SQL Server
int (int data type: In an Access project, a data type of 4 bytes (32
bits) that stores whole numbers in the range of 2^31 (2,147,483,64
through 2^31 1 (2,147,483,647).) (with the Identity property defined)

Help system leads to M$ site, and the best I've seen so far (since
autonumber don't reuse values) is

select top 1 autonumber_field from table order by autonumber_field
descending
--
> ================================================== ============ <
> (E-Mail Removed) | Wulfraed Dennis Lee Bieber KD6MOG <
> (E-Mail Removed) | Bestiaria Support Staff <
> ================================================== ============ <
> Home Page: <http://www.dm.net/~wulfraed/> <
> Overflow Page: <http://wlfraed.home.netcom.com/> <

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd loyola Microsoft Certification 3 11-14-2006 05:18 PM
microsoft.public.certification, microsoft.public.cert.exam.mcsa, microsoft.public.cert.exam.mcad, microsoft.public.cert.exam.mcse, microsoft.public.cert.exam.mcsd realexxams@yahoo.com Microsoft Certification 0 05-10-2006 02:35 PM
Re: Inserting record with Microsoft Access Steve Holden Python 2 02-12-2006 02:40 AM
Inserting record with Microsoft Access jeffhg582003 Python 3 02-11-2006 06:29 AM
microsoft.public.dotnet.faqs,microsoft.public.dotnet.framework,microsoft.public.dotnet.framework.windowsforms,microsoft.public.dotnet.general,microsoft.public.dotnet.languages.vb Charles A. Lackman ASP .Net 1 12-08-2004 07:08 PM



Advertisments