Board index » delphi » Special character in SqlQuery caused wrong parameters!

Special character in SqlQuery caused wrong parameters!


2008-07-18 07:05:11 AM
delphi123
I tried to run following query :
Insert into myTable(f1,f2) values('":Hi','v2');
SQL Query Show me that 'Hi' is not defined!? but why!?
":Hi is only a string value why SQL Query don't allow it in my table?
Im using Delphi 2007
And Driver=DBX, DBMS=SQLServer 2005
--
~~~~~~~~~~~
Best Regards
H.Ahmadi
 
 

Re:Special character in SqlQuery caused wrong parameters!

Insert into myTable(f1,f2) values('":'+'Hi','v2');
 

Re:Special character in SqlQuery caused wrong parameters!

Quote
Insert into myTable(f1,f2) values('":'+'Hi','v2');
DBX Query think that after ": is a paramater, then your query mean that
'+'Hi','v2'); is a parameter.
with your quert i have also the error but in your query '+'Hi','v2'); is
parameter of the error !!!
If you want see the error just do following steps:
1-create a form with one SQL Connection
2-create a SQL Query and set it is connection to the SQLConnection of step1
3-activate your connection
4-type your query in SQLQuery1.SQL and right click on SQLQuery and select
execute, you will see the error.
Thanks
 

Re:Special character in SqlQuery caused wrong parameters!

Quote
I tried to run following query :
Insert into myTable(f1,f2) values('":Hi','v2');
SQL Query Show me that 'Hi' is not defined!? but why!?
":Hi is only a string value why SQL Query don't allow it in my table?

Im using Delphi 2007
And Driver=DBX, DBMS=SQLServer 2005
Because parameter parsing in Delphi is *****
You can use, yeah, parameters to avoid these issues :-)
--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
www.upscene.com
My thoughts:
blog.upscene.com/martijn/
Database development questions? Check the forum!
www.databasedevelopmentforum.com
 

Re:Special character in SqlQuery caused wrong parameters!

Quote
Because parameter parsing in Delphi is *****
Not in Delphi, but in dbExpress. A query like:
SELECT NVL(FIELD, '?')
FROM TABLE
works perfectly in BDE, but gives a catastrophic error in dbExpress.
 

Re:Special character in SqlQuery caused wrong parameters!

Quote
>Because parameter parsing in Delphi is *****

Not in Delphi, but in dbExpress. A query like:

SELECT NVL(FIELD, '?')
FROM TABLE

works perfectly in BDE, but gives a catastrophic error in dbExpress.
That surprises me too, but believe me, there's plenty of problems
in TParams ...
--
Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, NexusDB, Oracle &
MS SQL Server
Upscene Productions
www.upscene.com
My thoughts:
blog.upscene.com/martijn/
Database development questions? Check the forum!
www.databasedevelopmentforum.com