Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 12 total
Thread Error Creating table handle..??
Mon, Dec 3 2012 7:33 AMPermanent Link

Maha

Hi

I'm using DBISam with Delphi 2007...
i'm using "insert into.." sql statement with dbisamQuery and DataSource components to insert a set of data into a data table...Data inserted correctly BUT, an exception raised says "Error Creating table handle.." which crash the whole program..

could anyone help me..??

Regards,
M.Mousa
Mon, Dec 3 2012 2:49 PMPermanent Link

Jeff Cook

Aspect Systems Ltd

Avatar

Hi M

Probably you are using "Open" to run the query where you should use
"ExecSQL".

Cheers

Jeff

P.S.  I'm a DBISAM3 (!!!!) user, so perhaps things have changed in the last
10 years Wink

--
Jeff Cook
Aspect Systems Ltd
www.aspect.co.nz

<Maha> wrote in message
news:CCADCC02-7445-4092-9515-ABF3648B52A0@news.elevatesoft.com...
> Hi
>
> I'm using DBISam with Delphi 2007...
> i'm using "insert into.." sql statement with dbisamQuery and DataSource
> components to insert a set of data into a data table...Data inserted
> correctly BUT, an exception raised says "Error Creating table handle.."
> which crash the whole program..
>
> could anyone help me..??
>
> Regards,
> M.Mousa
>

Tue, Dec 4 2012 5:36 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Maha

using DBISam with Delphi 2007...
>i'm using "insert into.." sql statement with dbisamQuery and DataSource components to insert a set of data into a data table...Data inserted correctly BUT, an exception raised says "Error Creating table handle.." which crash the whole program..

I'm guessing its the DataSource that's causing the trouble, probably hooked up to a visual control somewhere. INSERT doesn't produce a result set so after the SQL has run Delphi is trying to open something that doesn't exist in order to display it.

Roy Lambert [Team Elevate]
Tue, Dec 4 2012 10:24 AMPermanent Link

Maha

Thanks Jeff for your reply...
I tried both "Open" and "ExecSQL" although i know the difference, with NO change...the same exception appears Frown


"Jeff Cook" wrote:

Hi M

Probably you are using "Open" to run the query where you should use
"ExecSQL".

Cheers

Jeff

P.S.  I'm a DBISAM3 (!!!!) user, so perhaps things have changed in the last
10 years Wink

--
Jeff Cook
Aspect Systems Ltd
www.aspect.co.nz
Tue, Dec 4 2012 10:27 AMPermanent Link

Maha

Hi Roy...Thanks for your reply...
I can't understand your words..I got it it's a problem with the DataSource...could you explain more..??

Roy Lambert wrote:

Maha

using DBISam with Delphi 2007...
>i'm using "insert into.." sql statement with dbisamQuery and DataSource components to insert a set of data into a data table...Data inserted correctly BUT, an exception raised says "Error Creating table handle.." which crash the whole program..

I'm guessing its the DataSource that's causing the trouble, probably hooked up to a visual control somewhere. INSERT doesn't produce a result set so after the SQL has run Delphi is trying to open something that doesn't exist in order to display it.

Roy Lambert [Team Elevate]
Wed, Dec 5 2012 4:23 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Maha


One guess is that the datasource is pointing to an invalid table / query.

Try removing the datasource link from the query and see what happens.

Roy Lambert [Team Elevate]
Wed, Dec 5 2012 9:31 AMPermanent Link

Maha

Hi Roy...Thanks for your reply.. Smile
i removed the data source and tried to use:

procedure SaveBtnClick(Sender: TObject);
begin
Query.Close;
Query.SQl.Clear;
Query.SQL.Add('insert into User (UserID, Name) values (:UserID, :Name)');
Query.ParamByName('UserID').AsInteger:= LastUserID+1;
Query.ParamByName('Name').AsString:= NewUserNameEdit.Text;
Query.Active:=true;
Query.ExecSQL;
end;

but, unfortunately...the Same result...data inserted successfully and the same "Error Creating Table handle.." error raised..and the program crashed.. Frown

is that what you meant or not..??

Thanks in advance..



Roy Lambert wrote:

Maha


One guess is that the datasource is pointing to an invalid table / query.

Try removing the datasource link from the query and see what happens.

Roy Lambert [Team Elevate]
Wed, Dec 5 2012 10:09 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Maha


Setting the Active property of a query is the same as opening it but then you call ExecSQL as well. Either alone is fine but I'm not about both of them together. Since its not a script I can't see either of them causing a problem (opening an already open query should do nothing). Try taking the indicated line out. If that doesn't fix it have a look and see if you have any events hooked up to the query or if its being used in a master detail relationship or lookup somewhere. After that I've reached the end of my ability to guess. To give any more advice I'd need a copy of the app and tables so I can see what's going on.

>procedure SaveBtnClick(Sender: TObject);
>begin
>Query.Close;
>Query.SQl.Clear;
>Query.SQL.Add('insert into User (UserID, Name) values (:UserID, :Name)');
>Query.ParamByName('UserID').AsInteger:= LastUserID+1;
>Query.ParamByName('Name').AsString:= NewUserNameEdit.Text;
>Query.Active:=true; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>Query.ExecSQL;
>end;

Roy Lambert [Team Elevate]
Wed, Dec 5 2012 10:53 AMPermanent Link

Maha

Many Many Many Thanks Roy... Smile
the problem solved with removing "Query.Active:=true;"...
I really appreciate your help.. Smile
Thanks Roy Smile

Roy Lambert wrote:

Maha


Setting the Active property of a query is the same as opening it but then you call ExecSQL as well. Either alone is fine but I'm not about both of them together. Since its not a script I can't see either of them causing a problem (opening an already open query should do nothing). Try taking the indicated line out. If that doesn't fix it have a look and see if you have any events hooked up to the query or if its being used in a master detail relationship or lookup somewhere. After that I've reached the end of my ability to guess. To give any more advice I'd need a copy of the app and tables so I can see what's going on.

>procedure SaveBtnClick(Sender: TObject);
>begin
>Query.Close;
>Query.SQl.Clear;
>Query.SQL.Add('insert into User (UserID, Name) values (:UserID, :Name)');
>Query.ParamByName('UserID').AsInteger:= LastUserID+1;
>Query.ParamByName('Name').AsString:= NewUserNameEdit.Text;
>Query.Active:=true; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
>Query.ExecSQL;
>end;

Roy Lambert [Team Elevate]
Wed, Dec 5 2012 11:02 AMPermanent Link

Roy Lambert

NLH Associates

Team Elevate Team Elevate

Maha


>the problem solved with removing "Query.Active:=true;"...

Brilliant. With DBISAM (and continuing in ElevateDB) I moved to using ExecSQL for everything. I seem to recall it was mainly because I had quite a lot of scripts but ExecSQL works everywhere unlike Open or Active := True.

Roy Lambert [Team Elevate]


Page 1 of 2Next Page »
Jump to Page:  1 2
Image