Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Delphi Databases > Re: Database un...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 4 Topic 958 of 988
Post > Topic >>

Re: Database unique ID duplication problem

by ap <ap@[EMAIL PROTECTED] > Feb 7, 2007 at 12:57 AM

Dodgy wrote:
> 
>         adoquery1.FieldByName('PA_id').asstring:=''; // TBA, maybe
>         adoquery1.Post;
>         Log('Link ID '+adoquery1.FieldByName('id').AsString]);

It's not easy to understand code written by someone else, and without
any comments. It took me a while to find that the Log-line is for your
own personal debugging aid only, or is it? 

> The problem is every now and then the id field comes back with

Where exactly is the ID strange, in your adoquery1 or adoquery2 table?
You also gave no hint where does this first adoquery1 get it's 'id'
content, AutoInc Field probably? Nor any hint how you pass the same ID
to the second adoquery2. The Log-routine you introduced probably is not
your means to do that, or is it? 

> 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.

Then, that clearly tells that in those cases something is happening
between these two lines:
   adoquery1.Post;
   Log('Link ID '+adoquery1.FieldByName('id').AsString]);

The cursor in ADOQuery has moved elsewhere, to some older record. This
time it happens to be 9719, and your logging routine writes it down.
Could you have forgotten some sly code in your ADOQuery1.AfterPost
event?

Or if there was nothing, then you could try haunting that something by
adding one more line to Logging code:

   Log('Link ID Before Post '+adoquery1.FieldByName('id').AsString]);
   adoquery1.Post;
   Log('Link ID '+adoquery1.FieldByName('id').AsString]);
 
> Any ideas? It's really doing my head in.

I know the feeling:) And once you find the reason, you can't believe it
took you two whole days to catch this kind of silly typo in your own
code.

Sorry if I undestood the whole question and problem wrong, I do not use
TADO myself. Yet many of these DB and SQL problems are quite universal.
-ap
 




 4 Posts in Topic:
Database unique ID duplication problem
Dodgy <Dodgy@[EMAIL PR  2007-02-06 13:27:14 
Re: Database unique ID duplication problem
ap <ap@[EMAIL PROTECTE  2007-02-07 00:57:00 
Re: Database unique ID duplication problem
Dodgy <Dodgy@[EMAIL PR  2007-02-07 12:11:23 
Re: Database unique ID duplication problem
Grent <Grent@[EMAIL PR  2007-07-19 00:27:24 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 3:23:19 CDT 2008.