Board index » delphi » Delphi 1.0 / SQL Bug?

Delphi 1.0 / SQL Bug?

When trying to insert a record into a paradox 5.0 table using
the TQuery Component in Delphi 1.0 using the query

'INSERT INTO EmpWage (EmpID) VALUES (1);'

an error returns stating that there was an

'error creating cursor handle'

but the data is still entered into the table.

Anyone with ideas and willing to respond would be greatly appreciated.
E-mail suggestions on the address below are most welcome.
--
=========================== Nick Spiropoulos ================================
===================== s...@arcadia.cs.rmit.edu.au ===========================

 

Re:Delphi 1.0 / SQL Bug?


In article <5ln5j8$e8...@goanna.cs.rmit.edu.au>, Nick Spiropoulos
<s...@arcadia.cs.rmit.edu.au> writes

Quote
>When trying to insert a record into a paradox 5.0 table using
>the TQuery Component in Delphi 1.0 using the query

>'INSERT INTO EmpWage (EmpID) VALUES (1);'

>an error returns stating that there was an

>'error creating cursor handle'

>but the data is still entered into the table.

>Anyone with ideas and willing to respond would be greatly appreciated.
>E-mail suggestions on the address below are most welcome.

Make sure you run the query with "Query.ExecSQL" and NOT with
"Query.Open". Insert queries don't return datasets.

D1 help file:

ExecSQL method

Applies to

TQuery component

Declaration

procedure ExecSQL;

Description

Use the ExecSQL method to execute an SQL statement assigned to the SQL
property of a TQuery if the statement does not return a result set. If
the SQL statement is an INSERT, UPDATE, DELETE, or any DDL statement,
then use this method.
If the SQL statement is a SELECT statement, use Open instead.

Mark
--
Mark Williams                   M...@polyhdrn.demon.co.uk

Polyhedron Software Ltd.        
Programs for Programmers - QA, Compilers, Graphics

************ Visit our Web site on http://www.polyhedron.co.uk/ ************

Re:Delphi 1.0 / SQL Bug?


Quote
Mark Williams (M...@polyhdrn.demon.co.uk) wrote:

: <s...@arcadia.cs.rmit.edu.au> writes
: >When trying to insert a record into a paradox 5.0 table using
: >the TQuery Component in Delphi 1.0 using the query
: >
: >'INSERT INTO EmpWage (EmpID) VALUES (1);'
: >
: >an error returns stating that there was an
: >
: >'error creating cursor handle'
: >
: >but the data is still entered into the table.
: >
: >
: >Anyone with ideas and willing to respond would be greatly appreciated.
: >E-mail suggestions on the address below are most welcome.
:
: Make sure you run the query with "Query.ExecSQL" and NOT with
: "Query.Open". Insert queries don't return datasets.
: Mark
: --
: Mark Williams                   M...@polyhdrn.demon.co.uk

Thanks Mark, but I am already doing that...

--
=========================== Nick Spiropoulos ================================
===================== s...@arcadia.cs.rmit.edu.au ===========================

Re:Delphi 1.0 / SQL Bug?


Quote
Nick Spiropoulos wrote:

> When trying to insert a record into a paradox 5.0 table using
> the TQuery Component in Delphi 1.0 using the query

> 'INSERT INTO EmpWage (EmpID) VALUES (1);'

> an error returns stating that there was an

> 'error creating cursor handle'

> but the data is still entered into the table.

> Anyone with ideas and willing to respond would be greatly appreciated.
> E-mail suggestions on the address below are most welcome.
> --
> =========================== Nick Spiropoulos ================================
> ===================== s...@arcadia.cs.rmit.edu.au ===========================

Use an ExecSQL statement instead of an Open statement.  This occurs
since an Insert returns no data to the client, Delphi tries to create a
local cursor to capture the results, but THERE ISNT ANY!.  

Hope it helps.

Dan.

Other Threads