Solved

good practices of using dataset with controls

Posted on 2011-03-20
4
230 Views
Last Modified: 2012-05-11
Hi,

I have question about good practices of using dataset with controls

For example, i have list box that its datasource is dataset table.
1. If i change selection on list box, is dataset/table change its  current row?
2. If i change selection on list box, and want to get data of current row, should i use dataset/table or get data for listbox directly?
3. I have one dataset and in it i have tables and adapters. When i should move tables and adapters to separate dataset?
0
Comment
Question by:lavitz
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
starlite551 earned 167 total points
Comment Utility
The answers to your questions are as follows :
1. If u select from a list box then it doesnt change the current row in the dataset table. It occurs in the Control itself coz DataSet table is binded to it but as a DataSource.
2. Yes you should get the data directly from the list box bcoz it saves extra work,
3. Whenever you feel that there exists another DataSet that is bigger than current one and has more utility for current tables and adapters then you should prefer to move to another DataSet and also it depend on how closely the tables are related to tables of the new DataSet.
0
 
LVL 14

Assisted Solution

by:systan
systan earned 166 total points
Comment Utility
>>1. If i change selection on list box, is dataset/table change its  current row?
yes, if I understood it correctly

>>2. If i change selection on list box, and want to get data of current row, should i use dataset/table or get data for listbox directly?
no, you dont have to use another dataset,  you can get the selected record by what listbox datasource used.

>>3. I have one dataset and in it i have tables and adapters. When i should move tables and adapters to separate dataset?
When you use another table

Actually all your questions depends on your sql commands, like merging both tables, or 1 table alone.
0
 
LVL 14

Expert Comment

by:systan
Comment Utility
0
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 167 total points
Comment Utility
1) The DataTable itself has not concept of a "current row" so the answer is No. If you are using a BindingNavigator on your form then that is slightly different as the navigator will keep track of the relative row in the datatable.

2) Again, it depends how you have it configured and what you want to do. But generally you can take the value directly from the listbox.

3) Generally you'll only want the data you are using for a particular form/operation in memory. Again the specifics are context sensitive, so it depends on your objectives.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video discusses moving either the default database or any database to a new volume.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now