borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Greater Understanding of  Vb.net & ASP.NET)Next Topic (Creating TableAdapter) New Topic New Poll Post Reply
AndreaVB Forum : VB.Net : Filter query database, select from ListBox and beyond... Solved Topic
Poster Message
NigeLost
Level: Protégé

Registered: 21-11-2006
Posts: 6

icon Filter query database, select from ListBox and beyond...

(VB Exp 2005, SQL Exp 2005)

Let me put my situation into context and see if that helps you kind folks to help me.......

I run a number of training/consultancy sessions on a specific kind of analysis.

There are 3 categories of instrument: WS, JS & Obs

Each has specific inputs but all categores have a similar 4-point set of scores

I have 4 SQL DBases: Session, WS, JS, Obs

What I need to be able to do is:

Set up a new session, with an ID, Name & date, or select a past one.  Then:

- Enter WS, JS, Obs data "on the fly", during the Session
- Have a Session List & 3 separate Category lists (tabbed Listboxes?) where all items are dynamically updated
- Where I can select a Session and in the 3 Category Lists, all items in the Category relating to that Session are listed
- And selecting from the list will pull data from the appropriate DBase and process it into a diagram

I have:

Input Forms for each Category and can relate the 3 instrument forms (Read Only TextBoxes confirm this) to a specific Session.

I have a tabbed set of Listboxes to save real estate.  I can populate them but I am having difficulty in filtering - all items in the category are listed.  I have tried the SELECT Query (Select wsName, from wsList, where (sessionID =@sessionID).  That created an error: "The new command text returns data with schema different from the schema of the main query. Check your query's command text if this is not desired."

I have researched that and it appears it requires a DBNull acceptance, which I have done, but the filter is still not working.  

Also, I need to know how I can work the OnClick of an item in the list to get the details form the Dbase as it will have the item's name but not the ID.

Am I approaching the issue in the wrong way?
How do I get around the problems?

Your help would be much appreciated.

09-12-2006 at 06:43 PM
View Profile Send Email to User Show All Posts | Quote Reply
NigeLost
Level: Protégé

Registered: 21-11-2006
Posts: 6
icon Re: Filter query database, select from ListBox and beyond...

Got it!

It has been an uphill struggle: reading, surfing, experimenting.

It seems the filter was not working because I was SELECTing only one column out of all of them. This apparently causes a mismatch with the overarching "Fill" Query set up when the initial Dbase Diagram is automatically created, which SELECTs all columns and causes the error message.

The answer was to SELECT * (or leave the SELECT as per the auto-created Query) and add the Filter (@sessionID) and the ORDER method.

You only pick up in the code the column you actually need (in my case wsName) and ignore the rest.

My ListBox Selections work like a charm now! (But then I have new challenges in front of me!!)

I hope this helps any other newbie to avoid the hassle I went through!

Thanks for your time and attention.

13-12-2006 at 06:41 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB.Net : Filter query database, select from ListBox and beyond... Solved Topic
Previous Topic (Greater Understanding of  Vb.net & ASP.NET)Next Topic (Creating TableAdapter) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder