Link to home
Start Free TrialLog in
Avatar of bear040497
bear040497

asked on

Error creating cursor handle

Hi

I have a query, which are supposed to update all the entries in a table. The tablename is brukertb and is a Paradox table. The field which I try to update, is a logical field which I try to set to be False.
When I try running it, I get the message "Error creating cursor handle"

Here's my code:
 query1.sql.Clear;
 query1.sql.Add ('update brukertb set Def_signatur=False');
 query1.open;

I've tried several things, but can't find out to solve this.
Thanx for all help!
Avatar of viktornet
viktornet
Flag of United States of America image

I'm not sure, because I'm not much into DBase, but isn't your code suppose to look like this...
 
  query1.open;
  query1.sql.Clear;
  query1.sql.Add ('update brukertb set Def_signatur=False');

.instead of your way that is

  query1.sql.Clear;
  query1.sql.Add ('update brukertb set Def_signatur=False');
  query1.open;
-------------------

Regards,
Viktor Ivanov
ASKER CERTIFIED SOLUTION
Avatar of 333
333

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 333
333

P.S.
Viktor, Query.Open executes Sql statement. If Sql property is emty, Query.Open fails.

AP
As I said I still don't know much abouy DBase, but doesn't a person have to open first a query, before he starts clearing, reading and stuff...???

Regards,
Viktor Ivanov
Viktor,
I just say that when you call Query.Open, Delphi automaticaly executes SQL, posted in Query.Sql. If you are use TTable, then yes, you must first open table and then do what you want. But in Query it's a little different. So if you want to open whole database with Query, you must type something like this:

Query.Sql.Add('select * from mydb');  {all records of mydb database}
Query.Open;
{This 2 lines are like Table.Open}

But if you type

Query.Sql.Add('select * from mydb');  {all records of mydb database}
Query.Open;

you will see error 'No SQL statement available'. You can try this.

{ just trying to explain a little :) }
AP
Avatar of bear040497

ASKER

This example worked great!
Thanx a lot for your help!