?
Solved

Error creating cursor handle

Posted on 1998-08-13
6
Medium Priority
?
1,957 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 400 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

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!

Question has a verified solution.

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

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
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…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

650 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