Hi,
I'm not sure if this is a Delphi problem, or some "quirk" of MS SQL
server 2005, but it's really causing me agro, so if anyone has ever
seen this, and more im****tantly solved it, I would be very grateful!
I have 2 tables on an MS SQL Server 2005 database. I connect using a
TADOConnection
ConnectionString:Provider=SQLOLEDB.1;Password=*****;Persist Security
Info=True;User ID=*****;Initial Catalog=my_database;Data
Source=my_server_ip
And a TADOQuery which uses the above connection.
I insert 1 record into the first table with
adoquery1.Open;
adoquery1.Insert;
adoquery1.FieldByName('datetime').AsDateTime:=now;
adoquery1.FieldByName('zone').asstring:=Request.ContentFields.values['idcode'];
adoquery1.FieldByName('type').asstring:='reglist';
adoquery1.FieldByName('server').asstring:=copy(LocalIP,1,49);
adoquery1.FieldByName('PA_id').asstring:=''; // TBA, maybe
adoquery1.Post;
Log('Link ID '+adoquery1.FieldByName('id').AsString]);
And then I insert some other records into the 2nd table, which I link
to the first table with the "id" field I log above.
The problem is every now and then the id field comes back with
something really out of sequence, and when I look in the database it's
not the id that is associated with the record I just made!
The output of my log procedure shows things like
Link ID 222019
Link ID 222020
Link ID 9719
Link ID 222022
Link ID 222023
Sure enough, when I try to find 9719 in the database, it either
doesn't exist, or it's a really old record from days ago. If I look at
222021 (which I don't have in my log), sure enough I find the record I
inserted, which was re****ted as being 9719.
Any ideas? It's really doing my head in.
Dodgy.
--
MUSHROOMS ARE THE OPIATE OF THE MOOSES


|