473,288 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,288 software developers and data experts.

Datasource FilterExpression fails for string fields

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

May 17 '06 #1
1 1787
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.

"j.******@ahrc.ac.uk" wrote:
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

May 17 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: rob merritt | last post by:
I have a grideiw that feeds a detailView via 2 AccessDateSources the detail view has and update command that UpdateCommand="UPDATE SET = ? WHERE = " does'nt update since it doesn't...
1
by: fuchs.markus | last post by:
Hello, on my page, I have a DetailsViewControl connected to a SqlDataSource. Now when I dynamically set the FilterExpression and FilterParameters - for example in a OnClick-EventHandler of a...
2
by: DummyDumb | last post by:
Hi, I've got a Gridview utilizing a filterexpression: <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OnDeleted="ItemDeleted" EnableCaching="true"...
0
by: wubin_98 | last post by:
When I set a SqlDataSource1.FilterExpression value to " Partnumber LIKE '87-2055-___'" , SqlDataSource return empty. But I can get correct result in SQL query by including above expression. I...
1
by: mosscliffe | last post by:
I am trying to filter an accessdatsource by adding a FilterExpression If I have Field = 2 It works fine If I have Field IN (1,5,7) it works fine So now I want it to reference a...
2
by: AAJ | last post by:
I know this sounds nuts, but how do I remove the following filter from a Object Datasource that looks at my business layer... ODSDefaultUserProfiles.FilterExpression = "AllowedWebPage = '" +...
4
by: David | last post by:
I cannot get my aspx page (ASP.Net 2.0) to remove the FilterExpression on a SqlDataSource. Can someone tell me what I am doing wrong? Below is the SelectCommand: <asp:SqlDataSource...
1
by: jobs | last post by:
Cannot find column . Am I missing something here... SelectCommand="SELECT , , , refid FROM " FilterExpression="phone_nbr like @phone_nbr + '%'"
3
by: Curt | last post by:
I have a gridview object with a sqldatasource as its sourceid. Everything was going so well until I came across this problem. My SELECTCOMMAND for my sqldatasource is: select...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.