Solved

Error creating cursor handle

Posted on 1998-08-13
6
1,721 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now