1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
//Création de l'objet de connexion
OleDbConnection oConnection = new OleDbConnection();
String sConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + "\\\\chemin\\bd\\" + ";Extended Properties=dBase IV;User ID=Admin;Password=;";
oConnection.ConnectionString = sConnectionString;
// Ouverture de la connexion
oConnection.Open();
String requete = "SELECT * FROM table;";
OleDbCommand command = new OleDbCommand(requete, oConnection);
OleDbDataReader reader = command.ExecuteReader();
if (reader.Read())
{
string str = reader.GetValue(0).ToString();
Console.WriteLine("value 0 [ " + str + " ]");
}
Console.WriteLine("Appuyez sur Entrée ...");
Console.ReadLine(); |