private void btnLoad_Click(object sender, EventArgs e) { try { dgvPreview.Columns.Clear(); oraClient.OracleCommand cmd = oracleConnection.CreateCommand(); cmd.CommandText = txtWGStatement.Text; using (oraClient.OracleDataReader reader = cmd.ExecuteReader()) { if (reader.HasRows) { DataTable dataTable = new DataTable(); dataTable.Load(reader); dgvPreview.DataSource = dataTable; } reader.Close(); reader.Dispose(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error in btnLoad_Click()", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Chercher_Reprise(string id, out string erreur, out Bon_reprise br, out Boolean exist) { erreur = null; br = new Bon_reprise(); exist = false; rsql = "select * from BON_REPRISE where BON_REPRISE.NUM_BONREPRISE='" + id + "' "; cnx.select(rsql, out erreur, out dr); if (erreur == null) { if (dr.HasRows == true) { exist = true; dr.Read(); br.NUM_BONREPRISES = dr.GetString(0); br.DATE_REPRISE_REELS = dr.GetDateTime(1); br.NUM_TITRECONGES = dr.GetString(2); } dr.Close(); } }
public ActionResult Lister() { User user = (User)Session["User"]; Oracle.ManagedDataAccess.Client.OracleCommand ObjSelct = new Oracle.ManagedDataAccess.Client.OracleCommand("select * from QUESTIONS", user.connexion); Oracle.ManagedDataAccess.Client.OracleDataReader ObjeRead = ObjSelct.ExecuteReader(); List <Question> q = new List <Question>(); while (ObjeRead.Read()) { Question QQ = new Question(); QQ.Id = ObjeRead.GetString(0); QQ.Enoncer = ObjeRead.GetString(1); QQ.flag = ObjeRead.GetString(2); QQ.Dificulter = ObjeRead.GetString(3); q.Add(QQ); } ObjeRead.Close(); return(View(q)); }