Board index » delphi » SQL: "Error creating cursor handle"

SQL: "Error creating cursor handle"

Hi everybody

- Creating a new aplication
- 1 TQuery-component
- SQL-String: DELETE FROM 'Path+Tablename'
- Doubleclick to property "active" of TQuery-component deletes the table.
That's ok. But ... after this the TQuery keeps closed and I get an error
"Error creating cursor handle".

Where is the problem?

Thanks for every help.

Regards Peter

 

Re:SQL: "Error creating cursor handle"


  Don't use the design-time interface to delete a table.  Setting active to
True amounts to calling Open from code, which expects a result set to be
avaiable on which to build the cursor.  To execute a delete query, you call
ExecSQL from code, not Open, because ExecSQL does not require a result set.
-Howard

Re:SQL: "Error creating cursor handle"


Quote
>Peter Ruf wrote:

>"Error creating cursor handle".

You have to call Query.ExecSQL (instead of .Open or setting .Active =
true) for Queries that do not return a result set (INSERT, UPDATE,
DELETE, CREATE, ALTER ..).
________
Andreas
Delphi 5.01 Pro, NT4.0 Sp5
Direct replies mailto:p...@augsburg.netsurf.de

Re:SQL: "Error creating cursor handle"


As stated in the on-line help, you cannot use Open or Active := True for a
TQuery that does not return a result set (does not execute a SQL SELECT).
You must call the TQuery.ExecSQL method.

--
Bill

Other Threads