I’ve to retrieve information of an existing system which is using MS Access( :'( ).
So I added an existing Item(the mdb) to the project, and it created me a DataSet corresponding to all tables I’ve.
Once I’ve done this, I try to access to these data:
ClsDataSet dataSet = new ClsDataSet();
foreach (ClsDataSet.DOCDOCUMENTSRow docdocumentsRow in dataSet.DOCDOCUMENTS)
{
System.Console.WriteLine(docdocumentsRow.nom_document+"-->"+docdocumentsRow.nom_fichier);
}
System.Console.ReadLine();
Only to test…
But it doesn’t enter in the foreach, it seems it thinks that the table is empty? I directly step on the ReadLine();
So did I missed something? I don’t have any exception..
Should I load the table or something like this?
Thank you!
In the snippet you have posted there isn’t any
TableAdapterthat fills your schemas in the dataset you have created.DataSetis just a representation of what you have on db-side, so it is only a structure of db tables and doesn’t directly contain data.To fill your schema with database records you have to call
Fillmethod of the associatedTableAdapter. Usually it is created automatically by Visual Studio Designer when you drag-n-drop some database table in aDataSetschema (.xsd).