FITER ERROR IN C/S

delphi4.0+SQL server6.5----
I used  Filter in table(SQL server 6.5) ,but have a error:
  "Capability not Supported!"

  can you  tell me?

THE filter is:
 
  1: table1.filter:='coid'+'='+coname.text;
 
  2: table1.filter:='coid='+''+coname.text+'';

   "coid" is fieldname; coname is Tedit
==============================================  
 
thanks everyone!

I do as:

 1: database is actived
   
 2: used quotedstr() and anther

          but it is not work!
 
pchyAsked:
Who is Participating?
 
Phoenix_sConnect With a Mentor Commented:
try this one out for size...

table1.filter := 'coid = '''+coname.text+'''';

and yes... those are all single quotes.

SQL Server likes single quotes strings for queries and the only way to do it is to use a '' within the quotes on a string to make a single ' to be passed to sql server

I have to do this kinda crap on an almost daily basis and I KNOW it works ;)

0
 
kretzschmarCommented:
hi pchy,

can you show the filter, which you want to apply?

meikl
0
 
pchyAuthor Commented:
Edited text of question.
0
[Webinar] Improve your customer journey

A positive customer journey is important in attracting and retaining business. To improve this experience, you can use Google Maps APIs to increase checkout conversions, boost user engagement, and optimize order fulfillment. Learn how in this webinar presented by Dito.

 
pchyAuthor Commented:
Edited text of question.
0
 
geobulCommented:
Hi,

I have received the same error message when my database component is not in active state (not opened and connected or lost connection).

Regards,
Geo
0
 
kretzschmarCommented:
hi again pchy,

try this change (don't now yet, if mssql awaits a quoted or a doublequoted string, here both :

single quote
table1.filter:='coid='+QuotedStr(coname.text);

doublequoted
table1.filter:='coid='+AnsiQuotedStr(coname.text,'"');

meikl

0
 
kretzschmarCommented:
appendix,
i guess coid is a charfield and not a numeric-field.
meikl
0
 
pchyAuthor Commented:
Edited text of question.
0
 
pchyAuthor Commented:
Edited text of question.
0
 
kretzschmarCommented:
another try
table1.filter:='coid="'+coname.text+'"';

0
 
kretzschmarCommented:
? in this case (answer),
should also this work
table1.filter:='coid='+QuotedStr(coname.text);
0
 
Phoenix_sCommented:
kretzschmar:  I guess... I have NEVER used the quotedstr... hehehe
0
 
kretzschmarCommented:
hi Phoenix_s,

quotedstr is very usefull,
if you have to build a filter like
name = D'Arc
you must wrote then
Filter := 'name = ''D''Arc''';
that means also that you must parse the text if it comes from a var or editbox and you must double the singlequote. this all manages quotedstr for you.

meikl
0
All Courses

From novice to tech pro — start learning today.