SqlCeResultSet as DataSource?

  • Thread starter Thread starter dwok
  • Start date Start date
D

dwok

Hi All,

After looking at the documentation on the SqlCeResultSet I was under
the inpression that I could use this as a datasource for a list control
such as a ComboBox. However it does not seem to be working for me.

What I want to do is bind the ComboBox control such that I can set a
DisplayMember and ValueMember. From what I have seen so far the only
way I can currently do this is by using a DataSet which is more
overhead than I want, especially when I have no need to update the
DataSet.

I could use a SqlCeDataReader, which would be fast, but I know of no
way to set the ValueMember property of the items in the ComboBox using
this method. Any thoughts?
 
It could be. However, it's not recommended to use RS with ListControls, only
with simple controls like TextBox and with DataGrid.
If you bind RS to any ListControl, it would load all the records into
memory, not just visible records as in case of DataGrid.
As soon as RS has to retrieve all the records, its performance advantage
over DataSet/DataAdapter combination is lost.

Anyway, ValueMember/DisplayMember should be set to column names just like in
case of DataTable.
You could use GetName() method to get column names in RS.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
In this case I already know the column names. I am using the Northwind
sample database. What I want to do is populate a combobox with the list
of customers. I want to display the company name in the combobox but
hold the Customer ID in the itemData field of the combobox. It seems as
though the dataset is overkill in the situation.

dwok
 
In this case I already know the column names. I am using the Northwind
sample database. What I want to do is populate a combobox with the list
of customers. I want to display the company name in the combobox but
hold the Customer ID in the itemData field of the combobox. It seems as
though the dataset is overkill in the situation.

dwok
 
One way or another - with ListControl all the data will be loaded in memory.

DataSet stores it more efficiently and allows for easy sorting/filtering
plus supports related tables if needed.

With RS you would have to execute another RS with sorted/filtered query and
relations are up to you to process and enforce.



That would be completely different story if you have 20K records bound to a
DataGrid.

If would take a lot of memory and time to load that into the data set, RS
would only retrieve 10-20 visible rows providing huge performance benefit.

Anyway, if you have just couple hundred records, performance would be OK
with both DataSet and RS.


Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
Back
Top