Link to home
Start Free TrialLog in
Avatar of MSFanboy
MSFanboyFlag for Germany

asked on

Which DataSource should I decide for - not easy question BE AWARE - ;P

Hello,

I have a tricky situation I can`t help myself so this time a perfect 500 point answer is more than appreciated :P

I have a old DBASE database + some tables in it. I am using the .NET 2.0 DataProvider from SYBASE for ADS databases including DBASE databases.

This is the subtask my programm has to do:

Read certain Data from the dbase table. No Problem so far. Now I have to display this data in a DATAGRIDVIEW.

The user SHOULD be able to do differents things with the DATAGRIDVIEW:

1. Edit certain Columns which are readonly = false;
2. Sort certain Columns with the black Arrow on the ColumnHeader
3. Filter certain Columns (I found out BindingSource has a Filter() Method...)
4. Add single records
5. Remove single records

The question now is WHAT Object do I use which holds my dbase table data?

BindingList,List,BindingSource,DataTable,DataSet Whatever...

With your suggestions please consider I have NOT to write back any data to the DBASE table, just read it, do some stutt with it.
Avatar of BalkisBr
BalkisBr

You can use a DataView object.
Avatar of MSFanboy

ASKER

why CAN? I would like to know what is the MUST-USE Control with most flexibility + speed sorting/filtering e.g. 5000 records
Edit to the requirements: 
- Each column of the DataGridView must accept a Filter
If you want to do sorting and filtering you should use DataView.

Take a look on this article about DataView Performance.

http://msdn.microsoft.com/en-us/library/bb669089.aspx

You can do all you want using dataview.
Hm why cant I edit my own post??...
anyway I forgot to ask above:
What is the concrete object I should read in my dbase table`s data record for record ? Read the dbase table in the DataView object? Or should I read the dbase table into a DataTable and pass this object to the DataView constructor? Or should I read the dbase table into a DataSet and use the DataTable fill method?

You can do this...  (see code)

Load your data to table inside your DataView.

DataView YourDataView = new DataView();
YourDataView.Table.Load(YourCommand.ExecuteReader());

Open in new window


 DataView YourDataView = new DataView();
YourDataView.Table.Load(YourCommand.ExecuteReader());

Table is a property of the DataView, so why has your Table property a method = Load() ?
YourCommand.ExecuterReader() is ok I can use it with ADS.
From msdn:
"DataView Class - Represents a databindable, customized view of a DataTable for sorting, filtering, searching, editing, and navigation."

Your DataView is a view of a DataTable with more options.

The table property has a method called Load, because it's a real DataTable.
//correction
DataView YourDataView = new DataView(new DataTable());

Open in new window

ok my last question - hope so ;-) -
when I read my dbase data with myCommand.ExecuteReader() and assign the resultReader to the DataView, how do I afterwards add 2 columns programmatically to the Dataview?
example: from the dbase table I read 6 columns but I also want to add 2 editable coluns too to the DataView. I guess I add those 2 Columns to the DataTable object right ?

ASKER CERTIFIED SOLUTION
Avatar of BalkisBr
BalkisBr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
complete and accurate for this my question is not suitable. But your advise helped me surely to go in the right direction. Thank you!