Page 1 of 1

TMyQuery & Dynamic Query

Posted: Tue 06 May 2008 11:14
by tltmusashi
Hi

i need use dynamic querys, but when i doit this:

SQL

Code: Select all

SELECT * FROM agreement %s
CODE

Code: Select all

...
DefaultQuery := MyQuery1.SQL.CommaText;
...
MyQuery1.Active := False;
MyQuery1.SQL.Clear;
MyQuery1.SQL.CommaText := Format(DefaultQuery, ['WHERE 1=1']);//SAMPLE
MyQuery1.Active := True;
i see error message! ~"...SQL syntax is not right..."

сlean shielding query " a symbol, do shielding before sending query into server.

Posted: Tue 06 May 2008 11:20
by tltmusashi
can you Crypt DB Fields?
can you Crypt SQL Strings?

it is view when i open my application by notepad.


thx.

bug?

Posted: Wed 07 May 2008 05:26
by tltmusashi
bug?

when i put ConnectionDialog on the form and apply property

Code: Select all

...
MyConnection1.LoginPrompt := True;
...
and after run App, i see ConnectionDialog, why?
iam is`nt do

Code: Select all

...
MyConnection1.Connect();
...
MyDAC ver 5.20.1.14

Re: TMyQuery & Dynamic Query

Posted: Wed 07 May 2008 14:18
by Dimon
tltmusashi wrote:i need use dynamic querys, but when i doit this:
SQL

Code: Select all

SELECT * FROM agreement %s
CODE

Code: Select all

...
DefaultQuery := MyQuery1.SQL.CommaText;
...
MyQuery1.Active := False;
MyQuery1.SQL.Clear;
MyQuery1.SQL.CommaText := Format(DefaultQuery, ['WHERE 1=1']);//SAMPLE
MyQuery1.Active := True;
i see error message! ~"...SQL syntax is not right..."
We could not reproduce the problem.
Please send a complete small sample to dmitryg*crlab*com to demonstrate it, including a script to create and fill a table.

Re: bug?

Posted: Wed 07 May 2008 14:27
by Dimon
tltmusashi wrote:when i put ConnectionDialog on the form and apply property

Code: Select all

...
MyConnection1.LoginPrompt := True;
...
and after run App, i see ConnectionDialog, why?
iam is`nt do

Code: Select all

...
MyConnection1.Connect();
...
Probably, you have set the MyConnection.Connected property to True in desingntime and therefore on running of the application MyConnection connects to MySQL server.