| View previous topic :: View next topic |
| Author |
Message |
Manolis Guest
|
Posted: Sun Feb 12, 2006 7:03 pm Post subject: cannot open dataset after an sql error occured |
|
|
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
|
Posted: Sun Feb 12, 2006 9:03 pm Post subject: Re: cannot open dataset after an sql error occured |
|
|
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
|
Posted: Mon Feb 13, 2006 6:03 am Post subject: Re: cannot open dataset after an sql error occured |
|
|
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 |
|
 |
|