Solved

good practices of using dataset with controls

Posted on 2011-03-20
4
265 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
[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
  • 2
4 Comments
 
LVL 12

Accepted Solution

by:
starlite551 earned 167 total points
ID: 35175519
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
ID: 35175528
>>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
ID: 35175553
0
 
LVL 52

Assisted Solution

by:Carl Tawn
Carl Tawn earned 167 total points
ID: 35178951
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the adminiā€¦

742 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