Solved

good practices of using dataset with controls

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

914 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

13 Experts available now in Live!

Get 1:1 Help Now