Re: I'm having trouble with SQL
From: Bjørge Sæther (bjorge_at_hahaha_itte.no)
Date: 03/22/04
- Next message: NoName: "Understanding object repository"
- Previous message: J French: "Re: Sorting an array of integers"
- In reply to: gajo: "I'm having trouble with SQL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 22 Mar 2004 10:14:19 +0100
gajo wrote:
> 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.
...but why do you want a result set from your INSERT call ? If you set
RequestLive to 'false' and use 'TQuery.ExecSQL', you won't get a result
dataset at all.
> 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.
Yes, you need to have your data written to disk. A program crash is
dangerous with a local, file-based database like Paradox. In the BDE
Administrator, set System | Init | LOCAL SHARE = TRUE" for your alias. This
indicates other applications are using the very same tables, so data should
always be immediately flushed to the disk file.
> 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.
Your Index file is probably corrupted. This easily happens upon crashes.
Drop the index and recreate it.
> So what should I do?
> Btw. I'm using Paradox7 tables, with Delphi 5, on Windows ME.
-- Regards, Bjørge Sæther bjorge@haha_itte.no ------------------------------------- I'll not spend any money on American Software products until armed forces are out of Iraq.
- Next message: NoName: "Understanding object repository"
- Previous message: J French: "Re: Sorting an array of integers"
- In reply to: gajo: "I'm having trouble with SQL"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|