Solved

Error creating cursor handle

Posted on 1998-08-13
6
1,777 Views
Last Modified: 2012-08-13
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!
0
Comment
Question by:bear040497
  • 3
  • 2
6 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1362046
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
0
 
LVL 2

Accepted Solution

by:
333 earned 100 total points
ID: 1362047
bear,
when you execute SELECT statement, you must use Query1.Open or Query1.Active=True. When you execute UPDATE, INSERT, DELETE, etc., you must use Query1.ExecSql. So your code must look like this:

Query1.Sql.Clear;
Query1.Sql.Add('update brukertb set Def_signatur=False');
Query1.ExecSql;

AP
0
 
LVL 2

Expert Comment

by:333
ID: 1362048
P.S.
Viktor, Query.Open executes Sql statement. If Sql property is emty, Query.Open fails.

AP
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 10

Expert Comment

by:viktornet
ID: 1362049
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
0
 
LVL 2

Expert Comment

by:333
ID: 1362050
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
0
 

Author Comment

by:bear040497
ID: 1362051
This example worked great!
Thanx a lot for your help!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
proper way to parse text with delphi 7 121
Delphi XE10, MySQL Query 4 143
add combobox item based on numbers 9 143
Delphi - replicating a form 8 74
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

778 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question