BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

cannot open dataset after an sql error occured

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (dbExpress)
View previous topic :: View next topic  
Author Message
Manolis
Guest





PostPosted: Sun Feb 12, 2006 7:03 pm    Post subject: cannot open dataset after an sql error occured Reply with quote



Hi,
I use in a lot of forms, grids that have sources clientdatasets with SQLdatsets or simpledatasets. If my application in a case produces an error in a sql syntax and try to open the dataset and error occurs and the dataset doesn't open. If then I close the dataset and put a correct sql string the error doesn't appear but also the records of this dataset are not displayed. I must close my application and open if again in order to make this catalog work again.
Can you tell me the syntax how I can trap this sql sytax error and why the dataset doesn't return any records after the error?

Regards,
Manolis
Back to top
Bill Todd
Guest





PostPosted: Sun Feb 12, 2006 9:03 pm    Post subject: Re: cannot open dataset after an sql error occured Reply with quote



Are you opening and closing the ClientDataSet or the SQLDataSet?

Are you changing the SQL in the ClientDataSet.CommandText property or
the SQLDataSet.SQL property?

What database are you using?

Does the new SQL return a result set if you close the SQLConnection and
reopen it?

--
Bill Todd (TeamB)
Back to top
Manolis
Guest





PostPosted: Mon Feb 13, 2006 6:03 am    Post subject: Re: cannot open dataset after an sql error occured Reply with quote



Hi Bill,
I think I found the problem.
In my application I used the following commands:
clientdataset.Active:=False;
clientdataset.DisableControls;
SQLdataset.Close;
SQLdataset.CommandText:=SQLStr;
clientdataset.Active:=True;
clientdataset.EnableControls;

The problem was with the order of the DisableControls.
If I set it to run before closing the clientdataset
everything worked OK.
e.g:
clientdataset.DisableControls;
clientdataset.Active:=False;
SQLdataset.Close;
SQLdataset.CommandText:=SQLStr;
clientdataset.Active:=True;
clientdataset.EnableControls;

Regards,
Manolis

"Bill Todd" <no (AT) no (DOT) com> wrote:
Quote:
Are you opening and closing the ClientDataSet or the SQLDataSet?

Are you changing the SQL in the ClientDataSet.CommandText property or
the SQLDataSet.SQL property?

What database are you using?

Does the new SQL return a result set if you close the SQLConnection and
reopen it?

--
Bill Todd (TeamB)
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (dbExpress) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.