[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 196
  • Last Modified:

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.
0
MSFanboy
Asked:
MSFanboy
  • 5
  • 5
1 Solution
 
BalkisBrCommented:
You can use a DataView object.
0
 
MSFanboyAuthor Commented:
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
0
 
BalkisBrCommented:
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.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
MSFanboyAuthor Commented:
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?

0
 
BalkisBrCommented:
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

0
 
MSFanboyAuthor Commented:

 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.
0
 
BalkisBrCommented:
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

0
 
MSFanboyAuthor Commented:
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 ?

0
 
BalkisBrCommented:
Yes, you are right!

you can manipulate the DataTable to achieve what you want.
 dv.Table.Columns.Add("NewColumn");

Open in new window

0
 
MSFanboyAuthor Commented:
complete and accurate for this my question is not suitable. But your advise helped me surely to go in the right direction. Thank you!
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

  • 5
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now