SqlCeResultSet & DataGrids

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am having trouble formatting a datagrid that is using a ResultSet as the
DataSource. Does anyone know the mapping name for the tables?
 
here is a sample of usage:

// Queury the Orders table in the Northwind database
this.command.CommandText = "SELECT * FROM Orders";
ResultSetOptions options = ResultSetOptions.Scrollable |
ResultSetOptions.Sensitive;

this.resultSet = this.command.ExecuteResultSet(options);

this.dataGrid.DataSource = null;
// Bind the result set to the controls
this.BindData();

private void BindData()
{
// Dispose previous views bound to the currently active
RS
//
if (null != view1) ((IDisposable)view1).Dispose();
if (null != view2) ((IDisposable)view2).Dispose();

//Bind the data grid control
this.view1 = this.resultSet.ResultSetView;

//This array contains the ordinals of the columns
displayed in the grid
//Currently it is set to display only columns 1,3,5 and
8
int[] ordinals = new int[] { 1,3,5,8};
this.view1.Ordinals = ordinals;

this.dataGrid.DataSource = view1;

// etc
--
Darren Shaffer
..NET Compact Framework MVP
Principal Architect
Connected Innovation
www.connectedinnovation.com
 
Back
Top