1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
String Cnxstr = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Test.accdb";
OleDbConnection Cnx = new OleDbConnection { ConnectionString = Cnxstr };
String Sql = "SELECT TableTest.* FROM TableTest WHERE(((TableTest.N°) = 1))";
Cnx.Open();
OleDbCommand cmd = new OleDbCommand(Sql, cnx);
OleDbDataReader Dre = cmd.ExecuteReader();
DataTable schemaTable = Dre.GetSchemaTable();
while (Dre.Read())
{
foreach (DataRow row in schemaTable.Rows)
{
DataRow[] LaRow = row.GetChildRows();
String Colonne = row.Field<string>("ColumnName");
Type DataType = row.Field<Type>("DataType");
// String Legende = row.Field<string>("Caption"); //mais ca ca ne fonctionne pas, comment dois-je faire?
}
String toto = Dre[0].ToString();
toto = Dre[1].ToString();
toto = Dre[2].ToString();
}
cmd.Dispose();
cnx.Close();
cnx = null; |
Partager