Solved

Error creating cursor handle

Posted on 1998-08-13
6
1,857 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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 my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

717 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