A
A. Burch
I have 2 data sources (1 - DB, 2 - unbound table). I want to be able to
display all of the columns in a datagrid on a form. I can't seem to make
the unbound table show up when I run the program. The data table for the
2nd unbound table starts with nothing in it but has 5 columns defined. I
would like to see all of the columns from the DB and unbound table when the
form loads instead I just get the DB column names and data from the DB. My
data sources seem to be working correctly but I'm not able to get the
DataGrid to work correctly. I use a button on the form to start/stop the
async. data source and it does work, but I can't get the data to show up in
the DataGrid. I have tried MissingMappingAction, MissingSchemaAction and
doing a merge with the 2nd datatable. I decided to recode it and use an add
but that isn't working either?
What should I be doing to make to get the results I need.
c# code for this....
da = new OleDbDataAdapter(strSQL, oCon);
ds = new DataSet();
oCon.Open();
dt = new DataTable("unbound");
dc = new DataColumn();
// Last
dc.AutoIncrement = false;
dc.Caption = "Last";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add("Last", typeof(Double));
// Bid
dc = new DataColumn();
dc.AutoIncrement = false;
dc.Caption = "Bid";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add("Bid", typeof(Double));
// Ask
dc = new DataColumn();
dc.AutoIncrement = false;
dc.Caption = "Ask";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add("Ask", typeof(Double));
// Volume
dc = new DataColumn();
dc.AutoIncrement = false;
dc.Caption = "Volume";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add("Volume", typeof(Int32));
// Momentum
dc = new DataColumn();
dc.AutoIncrement = false;
dc.Caption = "Momentum";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add("Momentum", typeof(Int32));
ds.Tables.Add(dt);
//da.MissingMappingAction = MissingMappingAction.Ignore;
//da.MissingSchemaAction = MissingSchemaAction.Ignore;
numrows = da.Fill(ds);
//ds.Merge(dt,false,System.Data.MissingSchemaAction.Add);
Thanks....
Al
display all of the columns in a datagrid on a form. I can't seem to make
the unbound table show up when I run the program. The data table for the
2nd unbound table starts with nothing in it but has 5 columns defined. I
would like to see all of the columns from the DB and unbound table when the
form loads instead I just get the DB column names and data from the DB. My
data sources seem to be working correctly but I'm not able to get the
DataGrid to work correctly. I use a button on the form to start/stop the
async. data source and it does work, but I can't get the data to show up in
the DataGrid. I have tried MissingMappingAction, MissingSchemaAction and
doing a merge with the 2nd datatable. I decided to recode it and use an add
but that isn't working either?
What should I be doing to make to get the results I need.
c# code for this....
da = new OleDbDataAdapter(strSQL, oCon);
ds = new DataSet();
oCon.Open();
dt = new DataTable("unbound");
dc = new DataColumn();
// Last
dc.AutoIncrement = false;
dc.Caption = "Last";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add("Last", typeof(Double));
// Bid
dc = new DataColumn();
dc.AutoIncrement = false;
dc.Caption = "Bid";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add("Bid", typeof(Double));
// Ask
dc = new DataColumn();
dc.AutoIncrement = false;
dc.Caption = "Ask";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add("Ask", typeof(Double));
// Volume
dc = new DataColumn();
dc.AutoIncrement = false;
dc.Caption = "Volume";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add("Volume", typeof(Int32));
// Momentum
dc = new DataColumn();
dc.AutoIncrement = false;
dc.Caption = "Momentum";
dc.ReadOnly = false;
dc.Unique = false;
dt.Columns.Add("Momentum", typeof(Int32));
ds.Tables.Add(dt);
//da.MissingMappingAction = MissingMappingAction.Ignore;
//da.MissingSchemaAction = MissingSchemaAction.Ignore;
numrows = da.Fill(ds);
//ds.Merge(dt,false,System.Data.MissingSchemaAction.Add);
Thanks....
Al