🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.pascal.delphi.databases
4 messages
4 total messages Started by Tore Aursand Fri, 19 Jun 1998 00:00
Bug in Delphi when posting/appending records?
#98
Author: Tore Aursand
Date: Fri, 19 Jun 1998 00:00
36 lines
1756 bytes
Is this a bug?

I have never been in trouble when posting new records to a table,
but now it seems like *Delphi* is stuck.  Delphi says that "field
'id' must have a value" when trying to run the following snippet:

  with Table1 do
   begin
   { Generates an unique ID }
     if RecordCount > 0 then
      begin
        Last;
        NewID := Table1['ID'];
      end
     else NewID := 0;
   { Posts new information }
     Append;
     Table1['ID'] := NewID;
     Table1['Name'] := NameEdit.Text;
     Table1['Reference'] := ReferenceEdit.KeyValue;
     Post;
   end;

What is wrong?  I have another, similar, form in the program, and
it works just fine there.  Well - the two forms (with this little
code snippet) doesn't *do* the same in a practical meaning. :)

Can anyone figure *what* can be wrong here?


-- 
Tore Aursand - Frosta, Norway - toreau@sn.no - http://home.sol.no/~toreau/
"Spiralling falling, a silver machine.  From wings of freedom, silent
 above.  Eyelids were burning, summer sun roasting.  Tumbling chrome
 in the clear blue sky." -- Bruce Dickinson (Strange Death in Paradise)
Re: Bug in Delphi when posting/appending records?
#99
Author: Your Name
Date: Fri, 19 Jun 1998 00:00
15 lines
972 bytes
Haven't you put a >0 condition in the field id when you 
designed the table?

J.Santos
jasantos@mail.telenet.pt

In article <k/Zi1ErRvWaU092yn@sn.no>, toreau@sn.no says...
>
>Is this a bug?
>
>I have never been in trouble when posting new records to a table,
>but now it seems like *Delphi* is stuck.  Delphi says that "field
>'id' must have a value" when trying to run the following snippet:
>
Re: Bug in Delphi when posting/appending records?
#97
Author: Tore Aursand
Date: Sat, 20 Jun 1998 00:00
14 lines
1213 bytes
Yourname@somwhere.COM (Your Name) wrote:
> Haven't you put a >0 condition in the field id when you
> designed the table?

Nope.  I've tried setting NewID := !0 (which means *not* 0), but
it doesn't work what ever I do.


-- 
Tore Aursand - Frosta, Norway - toreau@sn.no - http://home.sol.no/~toreau/
"Spiralling falling, a silver machine.  From wings of freedom, silent
 above.  Eyelids were burning, summer sun roasting.  Tumbling chrome
 in the clear blue sky." -- Bruce Dickinson (Strange Death in Paradise)
Re: Bug in Delphi when posting/appending records?
#96
Author: Fausto Teixeira
Date: Tue, 23 Jun 1998 00:00
12 lines
849 bytes
It seems to me line 

>         NewID := Table1['ID'];

should read :

>         NewID := Table1['ID'] + 1;

Otherwise, you'll ALWAYS have a duplicate key.

Regards, Fausto.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads