Solved

good practices of using dataset with controls

Posted on 2011-03-20
4
263 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
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

Industry Leaders: 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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

685 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