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

Posted on 2014-04-14
Last Modified: 2014-04-14
select * from table_name where colname like ('%" :%')

getting error : no value for parameter '%')

paramcheck is disabled, but not helps
Question by:RT_
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 34

Expert Comment

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


Author Comment

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.
LVL 34

Accepted Solution

ste5an earned 500 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;

Open in new window

The order of ParamChek and the CommandText assignement is necessary to make it work.
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users


Author Comment

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;
LVL 34

Expert Comment

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.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%'');';

Open in new window


Author Closing Comment

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

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Six Sigma Control Plans

628 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