Re: I'm having trouble with SQL

From: Bjørge Sæther (bjorge_at_hahaha_itte.no)
Date: 03/22/04


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.


Relevant Pages

  • Re: SQL Runs in Access and not in ASP: 0x80040E10 Too few parameters
    ... Your expression is saying the equivalent of ... > These elements of my SQL string will come from variables in the ... Do you get the results you intend to get? ... Please reply to the newsgroup. ...
    (microsoft.public.inetserver.asp.db)
  • Re: Newbie. Reports & SQL.
    ... Yes basically what I was saying was that. ... zero out the consultant total. ... That involves writing SQL to produce a SUM value for each ...
    (comp.lang.pascal.delphi.misc)
  • Re: sql Statement Date object
    ... he is saying you should use a parameterized query. ... >> For your datetime column, you might have better luck by passing a ... >>> I have an ASP.net application with a connection to a sql database. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: php and flatfiles
    ... >>In a webserver context, you should now be accessing your SQL using ... > web server, so saying that people should "now" be using it is a bit ...
    (uk.net.web.authoring)
  • RE: SBS2003 Standard - managing the SQL installation?
    ... information for how to use SQL command line for MSDE 2000: ... 325003 How To Manage the SQL Server Desktop Engine (MSDE 2000) by Using the ... This newsgroup only focuses on SBS technical issues. ...
    (microsoft.public.windows.server.sbs)