473,587 Members | 2,547 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

FilterExpressio n - AccessDataSourc e

I am trying to filter an accessdatsource by adding a FilterExpressio n

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 dropdownlist

so I try Field = ddlCats.Selecte dValue - Fails Miserably

So I read further and try

Field='@FieldID '
and then in FilterParameter s I have FieldID pointing at
ddlCats.Selecte dValue

SelectedValue and the field being tested are INTS

SourceCode Generated
<asp:AccessData Source ID="accGetMatch ed" runat="server"
DataFile="~/AppData/lists.mdb"
SelectCommand=" SELECT[ListID], [CatID], [Category],
[Title], [Details] FROM [PublicLists] WHERE (([Title] LIKE '%' + ? +
'%') OR ([Details] LIKE '%' + ? + '%'))" FilterExpressio n="CatID =
'@CatID'">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="tbxL ookup"
Name="Title" PropertyName="T ext" Type="String" />
<asp:ControlPar ameter ControlID="tbxL ookup"
Name="Details" PropertyName="T ext" Type="String" />
</SelectParameter s>
<FilterParamete rs>
<asp:ControlPar ameter ControlID="ddlC ats" Name="CatID"
PropertyName="S electedValue" />
</FilterParameter s>
</asp:AccessDataS ource>
-------------------------------------------------------------------------------------------------

I get the following error message:
Cannot perform '=' operation on System.Int32 and System.String

The Like tests based on the textboxes all work it is only when I try to
filter on the value of the dropdownlist do I get the error.

I may be completely wrong in how I am attempting to do this filter, but
I will always do the LIKE Filtering, but only occasionally the
FilterEpression . When I get it working I will attempt to fill the
properties programmaticall y.

If I do not have the quotes around 'FieldID' it gives the error: Can't
find Column FieldID

Any pointers or example syntax, would be gratefully received.

May 29 '06 #1
1 3040
On further research it may be because SelectedValue is a string, but
when I try my filter as

<asp:AccessData Source ID="accGetMatch ed" runat="server"
DataFile="~/AppData/lists.mdb"
SelectCommand=" SELECT[ListID], [CatID], [Category],
[Title], [Details] FROM [PublicLists] WHERE (([Title] LIKE '%' + ? +
'%') OR ([Details] LIKE '%' + ? + '%')) order by category,
title" FilterExpressio n="CatID ='@CatID'">
<SelectParamete rs>
<asp:ControlPar ameter ControlID="tbxL ookup"
Name="Title" PropertyName="T ext" Type="String" />
<asp:ControlPar ameter ControlID="tbxL ookup"
Name="Details" PropertyName="T ext" Type="String" />
</SelectParameter s>
<FilterParamete rs>
<asp:Paramete r
DefaultValue="I nt32.Parse(ddlC ats.SelectedVal ue)" Name="CatID" />
</FilterParameter s>

Cannot perform '=' operation on System.Int32 and System.String

Please help, I am wasting so much time,

May 30 '06 #2

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

Similar topics

1
6501
by: Henry Habermacher [MVP Access] | last post by:
Environment: VS2005, ASP.Net 2.0, SQLServer 2000, VB.Net, IIS6 I use a GridView Control which is based on a SQLDataSource. The datasource is based on a Select statement and is filtered by the FilterExpression. The GridView also has a pager element (below, displaying first, previous, next, last icons), paging is enabled, page contains 10...
2
7776
by: DummyDumb | last post by:
Hi, I've got a Gridview utilizing a filterexpression: <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OnDeleted="ItemDeleted" EnableCaching="true" SqlCacheDependency="APP_TIMESHEET:AB" CacheKeyDependency="AB" SelectMethod="GetABs" TypeName="RetrieveABData" DeleteMethod="DeleteAB"
1
1797
by: j.gibson | last post by:
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
0
3004
by: DC | last post by:
Why would this code give me the error "Could not load type System.Web.UI.WebControls.AccessDataSource from assembly System.Web, Version=1.0.5000.0" at line 16... <form id="form1" runat="server"> Line 15: <div> Line 16: <asp:AccessDataSource ID="AccessDataSource1" Runat="server" DataFile="data\pubs.mdb" Line 17: ...
4
2336
by: msch-prv | last post by:
I use an Access db in my application. So far I have been exclusively working wtih the AccessDataSource controls to hook up to the db. I know that Access db connections can also be established with SqlDataSource. What are the trade-offs between the AccessDataSource and SqlDataSource? Also, I am confused about the connection state. What...
4
11742
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 ID="SqlClosedReason" runat="server" ConnectionString="<%$ ConnectionStrings:WcccuConnectionString %>" SelectCommand="SELECT NULL As seq_nbr, '-none-' As...
1
7052
by: jobs | last post by:
Cannot find column . Am I missing something here... SelectCommand="SELECT , , , refid FROM " FilterExpression="phone_nbr like @phone_nbr + '%'"
3
5158
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 alertid,subject,createdt,eventid,eventname, statuscd,trgid from vwAlerts order by createdt desc Now, based on a fiew input fields, I put together a WHERE clause for...
2
2114
by: dorandoran | last post by:
I got this from http://www.codeproject.com/KB/aspnet/EditNestedGridView.aspx. I dont like using accessdatasource. What are my option? (what I really like is to create a class and create object in the form, my backend is sql server. Can anyone please please help?) Thanks <Do> private AccessDataSource ChildDataSource(string strCustometId,...
0
7920
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8347
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6626
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5718
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3844
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1189
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.