Article View: borland.public.cppbuilder.database.ado
Article #302Auto Increment Field in MySQL
From: Colin B Maharaj
Date: Wed, 05 Jul 2006 01:14
Date: Wed, 05 Jul 2006 01:14
36 lines
2447 bytes
2447 bytes
Hi all, firstly I have began to move an application done
without any SQL system to a Relation Database model.
I created my own storage systems, caching systems, sorting systems
and formatting engines for my applications, I even created my own
web interface, with web engine built into my EXE, I then used the
SSL interceptors in Indy9 to make my web interface secure.
Now I am moving this to the web (again),
but this time using MYSQL, Apache, PHP (initially).
So what is my question......
I have just coded a routine using an ADOConnection to connect
to a MySQL database via an ODBC alias, then send data to one of the
tables using the ADOCommand component.
This is fine except I have an auto-increment field but anytime
I close my application and reopen it, the auto increment field starts
back from '1'.
here is my table....
CREATE TABLE event ( recid int(9) DEFAULT "0" NOT NULL AUTO_INCREMENT,
eventid tinyint(4),
pcdate datetime NOT NULL default "2000-01-01
00:00:00",
user varchar(12),
eventtext varchar(32),
PRIMARY KEY (pcdate, recid)
);
what I was hoping was that recid would auto increment to have something
like a record number. But it keeps reseting to '1' after you disconnect
and reconnect (or close / start) the application.
Any help will be appreciated.....
Technical Details
Message-ID:
<44ab128b$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.glorb.com!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!bandi.nntp.kabelfoon.nl!194.25.134.62.MISMATCH!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10698b,623a05051a5eb0ad,start X-Google-Attributes: gid10698b,public X-Google-Language: ENGLISH,ASCII-7-bit Date: Tue, 04 Jul 2006 21:14:53 -0400 From: Colin B Maharaj <noreply@myhost.com> User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.database.ado Subject: Auto Increment Field in MySQL Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 0627-0, 07/03/2006), Outbound message X-Antivirus-Status: Clean NNTP-Posting-Host: 201.238.86.65 Message-ID: <44ab128b$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1152062091 201.238.86.65 (4 Jul 2006 18:14:51 -0700) Lines: 48 Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news.glorb.com!news-out1.kabelfoon.nl!newsfeed.kabelfoon.nl!bandi.nntp.kabelfoon.nl!194.25.134.62.MISMATCH!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail