Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Pro Visual Basic 2005
Pro Visual Basic 2005 For advanced Visual Basic coders working in version 2005. Beginning-level questions will be redirected to other forums, including Beginning VB 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Visual Basic 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old October 4th, 2007, 09:26 AM
Registered User
Join Date: Oct 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataColumn.Expression problem in Dataset designer

Hi everyone,

Ok, I know this is more a General IDE question so sorry if I've posted this in th wrong forum. I hope I can be thorough with my explanation....In my VB.net 2005 app have a databse with 2 tables - structure as follows:

    DeptID (PK),

    DocumentID (PK),
    DeptID (FK on Table1)

Now, I have pulled in these 2 tables into my Dataset. In the dataset designer, I add a column to Dept and call it NumberActive (this is supposed to be a count of rows similar to a T-SQL statement: ...where Documents.DeptID = Dept.DeptID AND Documents.Active = True)

In a listbox bound to DeptBindingSource, another label on the form is supposed to be bound to NumberActive, so everytime the Listbox's SelectedIndexChanged event fires, the label will be refreshed with a count of Active documents for that department. Unfortunately, the label shows as '0' when I the form loads or when the selected index changes.

The expression that I am using for the in-designer-added column, NumberActive, is as follows:

Count(Child(FK_Documents_Dept).Active) = True

I have not done any additional coding behind the scenes, and I'm not sure if its necessary? Getting nowehere also searching Google.

Any help with this would be very much appreciated !

Thanx guys/gals!
- Shalan
Old October 4th, 2007, 03:10 PM
Friend of Wrox
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts

I think you need something more explicit to use count(), such as:
What you posted would be the syntax to make Count = True, an assignment that isn’t really meaningful, of course.
Old October 5th, 2007, 06:28 PM
Registered User
Join Date: Oct 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

Hi Brian,

I thought I could just construct an SQL query like that, but unfortunately the expression property for the datacolumn in my dataset designer does not allow actual T-SQL. Furthrmore, I am using SQL Server Compact Edition as my database, but I do not have the ability to construct nested queries on any of the tables.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Designer to UI Designer jitesh82 BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 2 April 16th, 2011 01:04 AM
Chapter 24: Description of DataSet Designer ali.net BOOK: Professional C#, 2nd and 3rd Editions 0 October 18th, 2008 07:08 PM
DataColumn.Expression problem shalan ADO.NET 0 October 4th, 2007 01:53 PM
Dataset Designer Question chrislepingwell ADO.NET 0 August 31st, 2006 06:27 AM
copy datacolumn from one dataset to another hkpanda ADO.NET 1 July 25th, 2003 12:04 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.