473,383 Members | 1,863 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,383 software developers and data experts.

problem in FilterParameters

Hi guys...

I have this

<asp:SqlDataSource ID="dsProdutos2" runat="server"

SelectCommand="SELECT * FROM [stoProducts]"

FilterExpression="idProduct='@idProduct'"

ConnectionString="<%$ ConnectionStrings:DBConn %>" >

<FilterParameters>

<asp:ControlParameter Name="idProduct" ControlID="MasterGrid"

PropertyName="SelectedValue" Type="Int16" />

</FilterParameters>

</asp:SqlDataSource>
And I get this Error:

System.Data.EvaluateException: Is not possible to execute the operation '='
in System.Decimal and System.String.
i have DataKeyNames="idProduct" and the ShowSelectButton="True" in the
MasterGrid gridview control

but in the Database is an integer with AutoIncrement...

How can I manage this, why is saying that it's a string? How can I cast it
to integer?

I already tried to change FilterExpression=" idProduct = '@idProduct' " to
FilterExpression=" idProduct = @idProduct "
but then I get an error that it couldnt find the column idProduct

--
Thank you in Advance.

Bruno Alexandre
(a Portuguese in Denmark)
Apr 5 '06 #1
1 1916
I was experiencing the same problem. I had originally had this code:

<asp:SqlDataSource ID="SqlDataSource4"
runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString
%>"
SelectCommand="SELECT * FROM [Sites]" FilterExpression="SiteID =
'@SiteID'">
<FilterParameters>
<asp:ControlParameter Name="SiteID" Type=Int32
ControlID="GridView1" PropertyName="SelectedValue" />
</FilterParameters>

which gave me the error you described:

I changed the code to:
<asp:SqlDataSource ID="SqlDataSource4"
runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString
%>"
SelectCommand="SELECT * FROM [Sites]" FilterExpression="SiteID =
'{0}'">
<FilterParameters>
<asp:ControlParameter Type=Int32 ControlID="GridView1"
PropertyName="SelectedValue" />
</FilterParameters>

ie: Changing the @SiteID parameter to {0} and removing the name from
the FileterParameter.

This must be a bug, it should have worked the other way also.

Gavin Stevens
MCSD.NET, MCAD.NET, MCSD
Ga***********@GMail.com

Bruno Alexandre wrote:
Hi guys...

I have this

<asp:SqlDataSource ID="dsProdutos2" runat="server"

SelectCommand="SELECT * FROM [stoProducts]"

FilterExpression="idProduct='@idProduct'"

ConnectionString="<%$ ConnectionStrings:DBConn %>" >

<FilterParameters>

<asp:ControlParameter Name="idProduct" ControlID="MasterGrid"

PropertyName="SelectedValue" Type="Int16" />

</FilterParameters>

</asp:SqlDataSource>
And I get this Error:

System.Data.EvaluateException: Is not possible to execute the operation '='
in System.Decimal and System.String.
i have DataKeyNames="idProduct" and the ShowSelectButton="True" in the
MasterGrid gridview control

but in the Database is an integer with AutoIncrement...

How can I manage this, why is saying that it's a string? How can I cast it
to integer?

I already tried to change FilterExpression=" idProduct = '@idProduct' " to
FilterExpression=" idProduct = @idProduct "
but then I get an error that it couldnt find the column idProduct

--
Thank you in Advance.

Bruno Alexandre
(a Portuguese in Denmark)


Apr 24 '06 #2

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

Similar topics

117
by: Peter Olcott | last post by:
www.halting-problem.com
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
1
by: Johnny §õ«¶¿« \(Microsoft MVP for ASP.NET\) | last post by:
The following code is from the online tutorial but it doesn't run on my CTP build I've just installed. The first problem is, ImageField doesn't have a public DataField field. Ok, I removed this...
1
by: Random | last post by:
In ASP.NET 2.0, it seems there's a bug with the parameters collections, as applied to at least the ObjectDataSource control. I can't get both an asp:QueryStringParameter and an...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
0
by: Andre | last post by:
Hi, I use a FilterExpression (FilterParameters) to select the value to be displayed in my DetailsView, but when i select a row in my GridView, the DetailsView retun this error: Cannot perform...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
0
by: David | last post by:
Using VS2005 and SQL2005. Is there any way to handle multiple FilterParameters or ControlParameters in SQLDataSource on a GridView? I have 4 asp:textbox fields that can have any combination of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.