OracleConnection cnx = new OracleConnection();
cnx.ConnectionString = "Data Source=devpla;User Id=developper;Password=developpeur;";
// Ouverture de la connexion
cnx.Open();
// Requête SQL a exécuter
string strCat = "SELECT id_Cat,NomCat from Categorie";
// Instanciation de l'objet OracleCommand et de ses propriétés
OracleCommand cmd = new OracleCommand(strCat);
cmd.Connection = cnx;
cmd.CommandType = CommandType.Text;
// On instancie notre OracleDataReader
OracleDataReader reader = cmd.ExecuteReader();
// Tant qu'il y a des résultats à lire, on les affiche
//while (reader.Read())
//{
// On affiche le nom et le numéro
//("Numerp: " + reader.GetInt32(0));
//("Nom: " + reader.GetString(1));
//}
Partager