Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2053
  • Last Modified:

VB.NET RowFilter With Boolean Value

Couldn't confirm this in a search of the Knowledgebase.  I have a SQL Server field, named Tag, of Bit DataType.  In VB.NET the same field in my typed DataTable is of type Boolean.
1.  How do I set the RowFilter (correct syntax) to WHERE Tag = True ?  ( I tried several possiblilties)

2.  Once the RowFilter is set correctly, will a CrystalReport, whose DataSource is my DataTable, honor the Filter ?

Thank you ...
0
cgaDesign
Asked:
cgaDesign
  • 3
  • 3
1 Solution
 
philipjonathanCommented:
Have you tried this for the RowFilter:
"Tag = True"  (without the "WHERE")

Not very sure about your Q2 though...
0
 
cgaDesignAuthor Commented:
Yes, I have tried "Tag = True" and "Tag = 1".  I need to confirm which, or both, will work correctly.  I'm not sure if the Filter is working, but I think I am getting the correct count (with "Tag = 1") from the DefaultView.Count property, after the Filter is applied.  But my report seems to be ignoring the Filter.
0
 
philipjonathanCommented:
Since Tag is boolean, I think it should be "Tag = True".

I'm not good with CrystalReport, so I don't think I can give advice on that. But if your DataSource is the DataTable, chances are the filter is not honoured. Would it work if you change the DataSource to the DataView?
0
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 
cgaDesignAuthor Commented:
I wanted a global DataSource that could be accessed by several objects, on several forms, such as for Grids, Reports and Exporting to other files.  I thought it was cleaner and more robust to have a separate class object that holds my DataSource objects.  I would like to know for sure how to use a boolean in a filter.  I'll probably re-post for the Crystal issue.  Thanks for your ideas.
0
 
philipjonathanCommented:
Yes, probably you would get better answer if you include the Crystal Reports Software zone. I'm sorry I can't really help you
0
 
cgaDesignAuthor Commented:
For my first question, though I could not find a direct answer anywhere, I confirmed by experimentation that the filter expression  "Tag = 1" does work on a DataTable  (for a boolean value of True).

My 2nd question was not answered, so I have posted another post more related to Crystal Reports.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now