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. 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, This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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...
|
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"
|
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
|
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: ...
|
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...
| |
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...
|
by: jobs |
last post by:
Cannot find column .
Am I missing something here...
SelectCommand="SELECT , , , refid
FROM "
FilterExpression="phone_nbr like @phone_nbr + '%'"
|
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...
|
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,...
|
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...
|
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...
| |
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| |