|
|
OleDbDataAdapter.Fill doesnt fill primary keys into DataTable |
|
Author |
Message |
Maartin
|
Posted: .NET Framework Data Access and Storage, OleDbDataAdapter.Fill doesnt fill primary keys into DataTable |
Top |
Hi, m_dbAdptrRemedies = new OleDbDataAdapter("", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + m_RemediesFilename);
m_dbAdptrRemedies.SelectCommand.CommandText = "SELECT Nr, Name, Bezug, [Position], * FROM tListenListe ORDER BY [Position]"; table = new DataTable(); m_dbAdptrRemedies.Fill(table);
Although Ive set a primary key for column "Nr" in MS Access the filled DataTable has no primary key set. Sure I could do it myself, but I want to find out if the SELECT command returns data with our without primary key, because there might be wrong tables that dont have it and this way wont allow to use a CommandBuilder for update lateron. (BTW: is it possible to make an existin column a primary key in .net and save it back to the database So far I always used MS Access to do this)
.NET Development30
|
|
|
|
|
DMan1
|
Posted: .NET Framework Data Access and Storage, OleDbDataAdapter.Fill doesnt fill primary keys into DataTable |
Top |
|
|
|
Paul Domag
|
Posted: .NET Framework Data Access and Storage, OleDbDataAdapter.Fill doesnt fill primary keys into DataTable |
Top |
|
|
|
Bill Lin - MSFT
|
Posted: .NET Framework Data Access and Storage, OleDbDataAdapter.Fill doesnt fill primary keys into DataTable |
Top |
You could use Adapter.FillSchema() to retrieve the primary key informaiton. Alternatively, you can set Adapter.DataAdapter.MissingSchemaAction to AddWithKey.
|
|
|
|
|
Maartin
|
Posted: .NET Framework Data Access and Storage, OleDbDataAdapter.Fill doesnt fill primary keys into DataTable |
Top |
Thx, for your great help!
|
|
|
|
|
|
|