Datasource FilterExpression fails for string fields

J

j.gibson

VS 2005
C#
ASP.NET


I have a Gridview which is filled from an objectdatasource. I have some
filtering - which works perfectly when the field to be filtered is an
INT.

dscIssues.FilterExpression += " and (assignedtoid = 1)" works ok

but if i filter on a string field is doesnt bring back any records

eg


dscIssues.FilterExpression += " and (name= 'tom')" fails

ive tried creating a FilterParamater as well, but it also fails
 
G

Guest

The syntax is correct, and filter expresion does work with strings, it is
likely that you have a logical error somehwere in the code that is creating a
different filter expression than you are expecting. Have you tried filtering
for strings by simply setting the complete FilterExpression property in one
line of code, rather than adding a where clause on at a later date. If that
works OK i would get your code to output the FilterExpresion property at
various points in the code so that you can track what is causing the problem.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top