U
user100
Need help please.
I'm filling a table with the data from a database. Everything is fine,
except after calling FillSchema, PrimaryKey property of the table[0]
remains empty, never gets set. I tried everything.
BTW, FillSchema does set column information, such as AllowDBNull,
etc..It just Primary Keys string that never gets set.
Please help.
Fill works all right too.
Table I'm working with has 1 primary key.
Here is my code:
****************************************************
OleDbCommand cm = new OleDbCommand("SELECT * FROM " + tableName,
conn);
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter();
da.SelectCommand = cm;
//Add constraints and pkeys
//da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
da.FillSchema (ds, SchemaType.Mapped);
DataTable dt = ds.Tables[0];
//Add rows
da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
da.Fill(dt);
****************************************************
user100
I'm filling a table with the data from a database. Everything is fine,
except after calling FillSchema, PrimaryKey property of the table[0]
remains empty, never gets set. I tried everything.
BTW, FillSchema does set column information, such as AllowDBNull,
etc..It just Primary Keys string that never gets set.
Please help.
Fill works all right too.
Table I'm working with has 1 primary key.
Here is my code:
****************************************************
OleDbCommand cm = new OleDbCommand("SELECT * FROM " + tableName,
conn);
DataSet ds = new DataSet();
OleDbDataAdapter da = new OleDbDataAdapter();
da.SelectCommand = cm;
//Add constraints and pkeys
//da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
da.FillSchema (ds, SchemaType.Mapped);
DataTable dt = ds.Tables[0];
//Add rows
da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
da.Fill(dt);
****************************************************
user100