?
Solved

good practices of using dataset with controls

Posted on 2011-03-20
4
Medium Priority
?
274 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 668 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 664 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 668 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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!
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

762 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