Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > problem in FilterParameters

Reply
Thread Tools

problem in FilterParameters

 
 
Bruno Alexandre
Guest
Posts: n/a
 
      04-05-2006
Hi guys...

I have this

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

SelectCommand="SELECT * FROM [stoProducts]"

FilterExpression="idProduct='@idProduct'"

ConnectionString="<%$ ConnectionStringsBConn %>" >

<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)


 
Reply With Quote
 
 
 
 
gavin.stevens@gmail.com
Guest
Posts: n/a
 
      04-24-2006
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
http://www.velocityreviews.com/forums/(E-Mail Removed)





Bruno Alexandre wrote:
> Hi guys...
>
> I have this
>
> <asp:SqlDataSource ID="dsProdutos2" runat="server"
>
> SelectCommand="SELECT * FROM [stoProducts]"
>
> FilterExpression="idProduct='@idProduct'"
>
> ConnectionString="<%$ ConnectionStringsBConn %>" >
>
> <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)


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in FilterParameters Bruno Alexandre ASP .Net Datagrid Control 1 04-24-2006 11:34 PM
Multiple FilterParameters in GridView David ASP .Net 0 04-19-2006 03:41 PM
FilterParameters Andre ASP .Net 0 01-10-2006 08:02 PM
Programmatically set FilterExpression and FilterParameters of SqlDataSource fuchs.markus@gmail.com ASP .Net 1 08-25-2005 02:24 PM
2.0 FilterParameters bug Random ASP .Net 1 06-07-2005 08:54 PM



Advertisments