M
mosscliffe
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 dropdownlist
so I try Field = ddlCats.SelectedValue - Fails Miserably
So I read further and try
Field='@FieldID'
and then in FilterParameters I have FieldID pointing at
ddlCats.SelectedValue
SelectedValue and the field being tested are INTS
SourceCode Generated
<asp:AccessDataSource ID="accGetMatched" runat="server"
DataFile="~/AppData/lists.mdb"
SelectCommand="SELECT [ListID], [CatID], [Category],
[Title], [Details] FROM [PublicLists] WHERE (([Title] LIKE '%' + ? +
'%') OR ([Details] LIKE '%' + ? + '%'))" FilterExpression="CatID =
'@CatID'">
<SelectParameters>
<asp:ControlParameter ControlID="tbxLookup"
Name="Title" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="tbxLookup"
Name="Details" PropertyName="Text" Type="String" />
</SelectParameters>
<FilterParameters>
<asp:ControlParameter ControlID="ddlCats" Name="CatID"
PropertyName="SelectedValue" />
</FilterParameters>
</asp:AccessDataSource>
-------------------------------------------------------------------------------------------------
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 programmatically.
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.
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.SelectedValue - Fails Miserably
So I read further and try
Field='@FieldID'
and then in FilterParameters I have FieldID pointing at
ddlCats.SelectedValue
SelectedValue and the field being tested are INTS
SourceCode Generated
<asp:AccessDataSource ID="accGetMatched" runat="server"
DataFile="~/AppData/lists.mdb"
SelectCommand="SELECT [ListID], [CatID], [Category],
[Title], [Details] FROM [PublicLists] WHERE (([Title] LIKE '%' + ? +
'%') OR ([Details] LIKE '%' + ? + '%'))" FilterExpression="CatID =
'@CatID'">
<SelectParameters>
<asp:ControlParameter ControlID="tbxLookup"
Name="Title" PropertyName="Text" Type="String" />
<asp:ControlParameter ControlID="tbxLookup"
Name="Details" PropertyName="Text" Type="String" />
</SelectParameters>
<FilterParameters>
<asp:ControlParameter ControlID="ddlCats" Name="CatID"
PropertyName="SelectedValue" />
</FilterParameters>
</asp:AccessDataSource>
-------------------------------------------------------------------------------------------------
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 programmatically.
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.