Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Delphi Databases > Re: SQL won't w...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 11 of 24 Topic 944 of 988
Post > Topic >>

Re: SQL won't work

by "Ray Porter" <ray_porter@[EMAIL PROTECTED] > Nov 2, 2006 at 10:40 PM

> 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
 




 24 Posts in Topic:
SQL won't work
Greg Gailer <g_gailer@  2006-10-26 16:44:52 
Re: SQL won't work
Dodgy <Dodgy@[EMAIL PR  2006-10-26 09:45:53 
Re: SQL won't work
Greg Gailer <g_gailer@  2006-10-26 19:56:48 
Re: SQL won't work
"pr" <pr@[EM  2006-10-26 12:34:08 
Re: SQL won't work
Dodgy <Dodgy@[EMAIL PR  2006-10-26 14:10:29 
Re: SQL won't work
Dodgy <Dodgy@[EMAIL PR  2006-10-26 14:09:18 
Re: SQL won't work
Greg Gailer <g_gailer@  2006-10-27 13:13:50 
Re: SQL won't work
Dodgy <Dodgy@[EMAIL PR  2006-10-31 10:58:18 
Re: SQL won't work
Greg Gailer <g_gailer@  2006-11-02 22:07:13 
Re: SQL won't work
"pr" <pr@[EM  2006-11-02 15:19:14 
Re: SQL won't work
"Ray Porter" &l  2006-11-02 22:40:54 
Re: SQL won't work
Greg Gailer <g_gailer@  2006-11-03 16:54:21 
Re: SQL won't work
Dan <Doculus at CMDCs  2006-10-26 18:56:24 
Re: SQL won't work
Greg Gailer <g_gailer@  2006-10-27 13:06:05 
Re: SQL won't work
"pr" <pr@[EM  2006-10-27 14:56:14 
Re: SQL won't work
Greg Gailer <g_gailer@  2006-10-28 09:49:20 
Re: SQL won't work
Dan <Doculus at CMDCs  2006-10-29 09:21:15 
Re: SQL won't work
Greg Gailer <g_gailer@  2006-11-02 22:10:46 
Re: SQL won't work
"Philip" <re  2006-11-02 15:08:46 
Re: SQL won't work
Greg Gailer <g_gailer@  2006-11-03 16:13:22 
Re: SQL won't work
"Philip" <re  2006-11-03 07:22:22 
Re: SQL won't work
"Philip" <re  2006-11-03 07:23:43 
Re: SQL won't work
Greg Gailer <g_gailer@  2006-11-04 11:58:40 
Re: SQL won't work
"Ray Porter" &l  2006-11-05 08:30:57 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 3:29:09 CDT 2008.