Not a mistake but the first thing I noticed is your insert statement:
> INSERT INTO datas VALUES ("12","blabla","tralala")
This assumes the order of fields in the table, which in yuor application,
might always be the same, but it is better to explicitly specify which
fields you are inserting to:
> INSERT INTO datas (field1, field2, field3, etc...)
> VALUES ("12","blabla","tralala")
This way, your application is not tied to any particular field order.
You will get an ENoResultSet exception if you try to open a query which has
an insert SQL statement. Instead of Open, use ExecSQL.
If you run out of memory, then it is possible for local BDE inserts to fail.
This would explain the 5 lost lines.
(I'm guessing) The inconsistent records between database desktop and your
application could be due to a index corruption, or possibly an inconsistent
state exist between the index and the table. You will need to rebuild all
the indices.
----- Original Message -----
From: "gajo" <[EMAIL PROTECTED]>
To: "NZ Borland Developers Group - Delphi List" <[EMAIL PROTECTED]>
Sent: Monday, March 22, 2004 5:24 AM
Subject: [DUG] I'm having troubles with using SQL
> Hi!
>
> I'm writing a somewhat basic SQL application. I use two local tables that
> are equi-joined by their INTEGER primary keyed fields, that I determine in
> my application. So here's the deal:
> I have a form that the user needs to fill. Once he clicks on OK the
program
> checks if everything's ok, and if it's so then it inserts the data into
the
> table by using the INSERT INTO datas VALUES ("12","blabla","tralala")
> command. When I do this I get an ENoResultSet saying that the BDE can't
find
> the cursor handle. Anyway, the data does get inserted, so I bypassed this
> exception with "try" and the user doesn't see anything's wrong. Anyway,
how
> can I make this message not appear at all? The Help said I should add a
> SELECT statement to the SQL command, but I don't see how.
>
> Part 2: Even after inserting the data, some of it might go missing. For
> example I inserted 6 lines and after Delphi crashed saying there isn't
> enough memory 5 lines got lost, and I have no clue why the 6th didn't. I
> remember seeing some SQL command in the InterBase SQL editor, something
> which sounded like "save changes", but since my current Delphi 5 doesn't
> have InterBase I can't find out which command it was.
> Finally, the weirdest thing: I inserted the 13th data, after which I
closed
> my application. Then I restarted it, tried to insert something else, and
got
> an exception saying that I'm trying to insert a value into the primary key
> field which is already inserted. In other words, field with the value 13
> already exists. I check the table but there isn't any 13th field. Then I
> open the table with Database Desktop and see that THERE IS a 13th field.
> I thought it was some BDE error so I restarted the computer, but after I
> started my program again, again there was no field 13, and again in DBD
> there was. I tried Query1.Refresh, but it didn't help.
>
> So what should I do?
> Btw. I'm using Paradox7 tables, with Delphi 5, on Windows ME.
>
> Gajo Csaba
>
>
> _______________________________________________
> Delphi mailing list
> [EMAIL PROTECTED]
> http://ns3.123.co.nz/mailman/listinfo/delphi
>
_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi