?
Solved

linqdatasource where bit field value = true

Posted on 2010-11-09
4
Medium Priority
?
1,728 Views
Last Modified: 2012-05-10
Hi EE.

I have a dropdownlist bound to a linqdatasource.   The table it is bound to has a bit field.
I simply want to filter the linqdatasource by this field.
i.e. where bitfield = true

How do I do this?

Thanks
0
Comment
Question by:Sheritlw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 

Author Comment

by:Sheritlw
ID: 34099259
I love those articles and that is where I have got most of my information.
Problem is with the boolean value I get an error regarding the == not being int32.

I need to know how to filter by a boolean value.

Thanks


<asp:LinqDataSource ID="LnqLUServicesPrimary" runat="server" 
                                       ContextTypeName="SalonDataClassesDataContext" TableName="ServicesLUs" 
                                       Where="MultiServ == @MultiServ">
                                      <WhereParameters>
                                            <asp:Parameter Name="MultiServ" Type="Boolean" DefaultValue="true" />
                                       
                                      </WhereParameters>
                                  </asp:LinqDataSource>

Open in new window

0
 

Accepted Solution

by:
Sheritlw earned 0 total points
ID: 34099349
I figured it out.
If values in the field are null then you will receive an exception similar to Operator '==' incompatible with operand types 'Boolean?' and 'Int32'.

Since I added the field when there was already data in the table, the field held null values.  Once I edited the table, I changed the aspx to the code below... and it works!


<asp:LinqDataSource ID="LnqLUServicesPrimary" runat="server" 
                                       ContextTypeName="SalonDataClassesDataContext" TableName="ServicesLUs" 
                                       Where="MultiServ == True">
                                      <WhereParameters>
                                            <asp:Parameter Name="MultiServ" Type="Boolean" DefaultValue="true" />
                                       
                                      </WhereParameters>
                                  </asp:LinqDataSource>

Open in new window

0
 

Author Closing Comment

by:Sheritlw
ID: 34130324
Found answer
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question