Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

TSQL Delphi query get parameter error when where containing " and % BOTH characters

Posted on 2014-04-14
6
Medium Priority
?
545 Views
Last Modified: 2014-04-14
select * from table_name where colname like ('%" :%')

getting error : no value for parameter '%')

paramcheck is disabled, but not helps
0
Comment
Question by:RT_
  • 3
  • 3
6 Comments
 
LVL 36

Expert Comment

by:ste5an
ID: 39998806
What chars are you looking for? How does the condition looks like in SSMS?

Keep in mind that ' and " need to be escaped. E.g.

Condition := 'WHERE colname LIKE ''%:%''';

Open in new window

0
 

Author Comment

by:RT_
ID: 39999139
here are the string, that i am searcing for :

ACER monitor AL1512 15" 1024*768, 400:1 kontrasztarány, 350cd/m2 - használt

but on insert statement, the problem is the same.

When i'll cut the " or the :  chars, the query is working.

The database is on Mysql.
0
 
LVL 36

Accepted Solution

by:
ste5an earned 2000 total points
ID: 39999278
Yup, the single quotation mark is the Pascal string delimiter and the colon is the indicator for a parameter (haven't seen this either in your first post).

The single quotation mark must be doubled to be escaped. The colon needs that you set it by a string variable:

SqlStatement := 'SELECT * FROM table_name WHERE colname LIKE ( ''%":%'');';
AdoDataSet.ParamCheck := False;
AdoDataSet.CommandText := SqlStatement;
AdoDataSet..Open;

Open in new window


The order of ParamChek and the CommandText assignement is necessary to make it work.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:RT_
ID: 39999307
here is the exact code, the double quotation is there but, still the no value for parameter 1


f_DataModule.MSHQms_fotabla_v.SQL.Text := 'select * from ms_raktar where megjegyzes like (''%ACER monitor AL1512 15" 1024*768, 400:1 kontrasztarány, 350cd/m2 - használt%'');';

f_DataModule.MSHQms_fotabla_v.ParamCheck := False;
f_DataModule.MSHQms_fotabla_v.Open;
0
 
LVL 36

Expert Comment

by:ste5an
ID: 39999597
No, take a look at my sample again.

f_DataModule.MSHQms_fotabla_v.Close; // Just in case that not.
f_DataModule.MSHQms_fotabla_v.SQL.Clear;
f_DataModule.MSHQms_fotabla_v.ParamCheck := False;
f_DataModule.MSHQms_fotabla_v.SQL.Text := 'select * from ms_raktar where megjegyzes like (''%ACER monitor AL1512 15" 1024*768, 400:1 kontrasztarány, 350cd/m2 - használt%'');';
f_DataModule.MSHQms_fotabla_v.Open;

Open in new window

0
 

Author Closing Comment

by:RT_
ID: 39999845
Thanks a lot, i have found the difference and now it works!
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question