> Well, that was a good thought. I changed the query as you said. I dropped
> a TADOConnection, got it to connect, used a TADOQuery, DatasetProvider,
> ClientDataset and then a DataSource on the form. Connected them all
> together and checked that my basic SQL was working again and then tried
> the code again. Still no success I'm afraid. Is there anything else that
> can stop the query from accessing the database? It seems like the basic
> component SQL statement is working but the code isn't. There must be
> something disabling the query.
> Greg
Greg,
Can you post an example of your ADO code? I noticed you mentioned using a
DataProvider and ClientDataset? Neither of those are necessary or wanted
for
ADO connectivity. All you need is a TADOConnection, a TADODataSet (or the
equivalent TADOQuery) and a TDataSource if you're using bound controls.
Do I understand correctly that you have entered an SQL statement at design
time and it seemed to work just fine but when you try to enter a different
SQL statement at runtime, it seems to just execute the original, design
time
SQL statement? It isn't that SQL isn't being executed, it's as if the
design time SQL statement is somehow not being replaced by your runtime
SQL
statement?
I dropped the BDE long ago in favor of ODBCExpress then ADO. I've used
ADO
extensively with Sybase and Oracle (and with MS Access) with no problems
whatsoever. Remove the BDE components from your project completely. Drop
a
TADOConnection on your form or in your data module and make sure the
connection string to your MySQL database is correct. Add a TADODataSet
(the
TADOQuery was only provided for backwards compatibility, you should use
the
TADODataSet component on new projects). Make sure the "Connection"
property
of the TADODataSet is set to your TADOConnection object. Add a
TDataSource
and point it to your TADODataSet. Then do something like the following:
var strSQL: String;
.....
MyADOConnection.Open;
....
strSQL := 'select ... '; //your SQL statement here
with MyADODataSet do
begin
Close;
CommandText := strSQL;
Open;
end;
....
MyADODataSet.Close;
MyADOConnection.Close;
Ray ****ter


|