Solved

Loop through SQL records to create multiple drop-down menus on a form

Posted on 2004-10-08
10
210 Views
Last Modified: 2010-04-23
I hope I explain this well.  

Basically, I have a windows form on which I want to populate on the screen a number of records from a SQL table.  Next to each record, I want a drop-down which is also derived from data in another SQL table.  The intent is to map the records from the first table to a value in the drop-down list.

I know how to do this well in ASP/VBScript using a loop.  How can I do this in VB.Net?
0
Comment
Question by:ABaruh
[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
  • 5
  • 3
  • 2
10 Comments
 
LVL 7

Author Comment

by:ABaruh
ID: 12261939
Also, how do I create a window on the form that will have a scroll bar so that if my first list is big, it won't go off the screen?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12262014
Do you have SQLDataAdapter and DataReader or DataSet?

Bob
0
 
LVL 7

Author Comment

by:ABaruh
ID: 12262122
DataSet
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 96

Expert Comment

by:Bob Learned
ID: 12262130
How many tables in the data set?  Are there any relationships?

Bob
0
 
LVL 7

Author Comment

by:ABaruh
ID: 12262273
To clarify, I mentioned that there are two tables accessed.

The first table (Table1) contains the records I will be mapping.

The second table (Table2) contains the records that will populate a drop-down list.  The user of this application will map a record from the list in Table1 to a value in Table2.

I want to loop through the records in Table1 and create a row on my form.  For each row that gets painted on the form, create a drop-down populated from Table2.  A submit button will be on the bottom of the form.  The user will identify which records from Table1 will be mapped to a selected value from the drop-down list, then press submit.  The mapped values will go into a third table, but I know how to do this part just fine.  What I dont know how to do is dynamically populate records from Table1 on my screen with a drop-down next to each record returned from Table1.
0
 
LVL 7

Author Comment

by:ABaruh
ID: 12262363
I will have each table in its own dataset.  Or I can populate the textboxes and drop-downs from ADO.  I'm not sure which would be better.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12262408
IMHO, I believe that the parent-child relationship between 2 tables with 1 dataset with a DataRelation between the 2 would be the proper course of action.

Bob
0
 
LVL 7

Author Comment

by:ABaruh
ID: 12262540
What about the way I'd go about putting the textboxes and drop-downs on the screen?
0
 
LVL 4

Expert Comment

by:eozz_2000
ID: 12266248
Set th AutoScroll property of your form to True.
0
 
LVL 4

Accepted Solution

by:
eozz_2000 earned 500 total points
ID: 12266272
And with the tables... you can do a dataView and set its rowFilter property accordingly the value selected in the parent control.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

615 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