Board index » delphi » execute SQL statement

execute SQL statement

Hi !

If i should execute a SQL statment like create table, crate database
etc.
i could use TQuery, but i get this error message:
"Error creating cursor handle", probably becouse tquery expects a
dataset as result, witch create operations dont return.
so my question is: Witch component should i use instead of tquery, or is
there a way to
manipulate tquery so i can use it for sql statement like create table,
create database etc.

very greatful for help
    --- John Gunnarsson, Imperia

ps. please send a copy to my mailbox
i...@jamtway.se

 

Re:execute SQL statement


use ExecSQL method instead of OPEN...

Re:execute SQL statement


Are you using Query.Open or Query.ExecSQL?  And are you setting the
databasename property?
Quote
John Gunnarssin wrote in message <366806BD.492DB...@jamtway.se>...
>Hi !

>If i should execute a SQL statment like create table, crate database
>etc.
>i could use TQuery, but i get this error message:
>"Error creating cursor handle", probably becouse tquery expects a
>dataset as result, witch create operations dont return.
>so my question is: Witch component should i use instead of tquery, or is
>there a way to
>manipulate tquery so i can use it for sql statement like create table,
>create database etc.

>very greatful for help
>    --- John Gunnarsson, Imperia

>ps. please send a copy to my mailbox
>i...@jamtway.se

Re:execute SQL statement


Quote
On Fri, 04 Dec 1998 16:58:53 +0100, John Gunnarssin <i...@jamtway.se> wrote:
>Hi !

>If i should execute a SQL statment like create table, crate database
>etc.
>i could use TQuery, but i get this error message:
>"Error creating cursor handle", probably becouse tquery expects a
>dataset as result, witch create operations dont return.
>so my question is: Witch component should i use instead of tquery, or is
>there a way to
>manipulate tquery so i can use it for sql statement like create table,
>create database etc.

Try using TQuery.ExecSQL
UIN:3620584                                            Bask
mailto:b...@kis.p.lodz.pl

Re:execute SQL statement


Quote
John Gunnarssin wrote:
> Hi !

> If i should execute a SQL statment like create table, crate database
> etc.
> i could use TQuery, but i get this error message:
> "Error creating cursor handle", probably becouse tquery expects a
> dataset as result, witch create operations dont return.
> so my question is: Witch component should i use instead of tquery, or is
> there a way to
> manipulate tquery so i can use it for sql statement like create table,
> create database etc.

> very greatful for help
>     --- John Gunnarsson, Imperia

> ps. please send a copy to my mailbox
> i...@jamtway.se

  The Query component has theese two methods to execute SQL statements::

Query.Open ( here you place statements like SELECT * from table
where..........)

Query.ExecuteSQL ( here you place statements like CREATE TABLE, INSERT INTO,
UPDATE TABLE and so on).

Now it is most likely that you are getting that error message because you
are trying to issue you "CREATE TABLE"
using "Query.Open".

Use Query.ExecuteSQL instead!

Med v?nlig h?lsning

Giovanni Ferrari

Other Threads