Board index » delphi » "Error creating cursor handle"

"Error creating cursor handle"

With the following code:

 with TQuery.create(self)do
          try
            SQL.Text := 'Delete from MyTable Where CategoryName =
:catname';
            Params[0].AsString := TreeView1.Selected.Text;
            Open;
            TreeView1.Selected.Delete;
          finally
            free;
          end;

I get "Error creating cursor handle" when the query executes (the 'Open'
line).

But the query 'works' - it deletes the correct record from the table
(but before it gets to the line which deletes the treeview node).

Does anyone have any idea about how to prevent this error message?

Thanks,
Glenn Galbraith

 

Re:"Error creating cursor handle"


Hi Glenn,

If you are using the TQuery to carry out an action rather
than returning an answer set you should use the ExecSQL
method rather than Open.

Carl

Quote
gglo...@pcisys.net wrote:

> With the following code:

>  with TQuery.create(self)do
>           try
>             SQL.Text := 'Delete from MyTable Where CategoryName =
> :catname';
>             Params[0].AsString := TreeView1.Selected.Text;
>             Open;
>             TreeView1.Selected.Delete;
>           finally
>             free;
>           end;

> I get "Error creating cursor handle" when the query executes (the 'Open'
> line).

---8<---
--
Please remove 'no__junk' from the return address to Email
me.

Re:"Error creating cursor handle"


Quote
Carl Caulkett wrote:

> Hi Glenn,

> If you are using the TQuery to carry out an action rather
> than returning an answer set you should use the ExecSQL
> method rather than Open.

> Carl

> gglo...@pcisys.net wrote:

> > With the following code:

> >  with TQuery.create(self)do
> >           try
> >             SQL.Text := 'Delete from MyTable Where CategoryName =
> > :catname';
> >             Params[0].AsString := TreeView1.Selected.Text;
> >             Open;
> >             TreeView1.Selected.Delete;
> >           finally
> >             free;
> >           end;

> > I get "Error creating cursor handle" when the query executes (the 'Open'
> > line).
> ---8<---
> --
> Please remove 'no__junk' from the return address to Email
> me.

Thanks!  that was it (and only an hour after I posted the question)
Glenn

Other Threads