Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using Oracle.DataAccess.Client;
- namespace lab2___ado
- {
- public partial class Form1 : Form
- {
- string ChaineConnexion;
- OracleConnection conn;
- DataSet monDataset = new DataSet();
- public Form1()
- {
- InitializeComponent();
- }
- private void BTN_connect_Click(object sender, EventArgs e)
- {
- string username = "MORINJER";
- string password = "ORACLE1";
- string dSource = "(DESCRIPTION="
- + "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)"
- + "(HOST=mercure.clg.qc.ca)(PORT=1521)))"
- + "(CONNECT_DATA=(SERVICE_NAME=ORCL.clg.qc.ca))) ";
- ChaineConnexion = "Data Source =" + dSource + " ;User Id=" + username + ";Password=" + password + ";";
- conn = new OracleConnection();
- conn.ConnectionString = ChaineConnexion;
- try
- {
- conn.Open();
- OracleCommand ObTotal = new OracleCommand("GESTIONEMPLOYES", conn);
- ObTotal.CommandText = "GestionEmployes.TOTALEMP";
- ObTotal.CommandType = CommandType.StoredProcedure;
- TB_nbemp.Text = ObTotal.Parameters["TOTALNBEMP"].Value.ToString();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- private void BTN_jaibesoindunbouton_Click(object sender, EventArgs e)
- {
- try
- {
- OracleCommand oraAjout = new OracleCommand("GESTIONEMPLOYES", conn);
- oraAjout.CommandText = "GESTIONEMPLOYES.INSERTION";
- oraAjout.CommandType = CommandType.StoredProcedure;
- OracleParameter orapamNUMEMP = new OracleParameter("PNUMEMP", OracleDbType.Int32);
- orapamNUMEMP.Direction = ParameterDirection.Input;
- orapamNUMEMP.Value = TB_num.Text;
- oraAjout.Parameters.Add(orapamNUMEMP);
- OracleParameter orapamNOMEMP = new OracleParameter("PNOMEMP", OracleDbType.Varchar2);
- orapamNOMEMP.Direction = ParameterDirection.Input;
- orapamNOMEMP.Value = TB_Nom.Text;
- oraAjout.Parameters.Add(orapamNOMEMP);
- OracleParameter orapamPRENOMEMP = new OracleParameter("PPRENOMEMP", OracleDbType.Varchar2);
- orapamPRENOMEMP.Direction = ParameterDirection.Input;
- orapamPRENOMEMP.Value = TB_Prenom.Text;
- oraAjout.Parameters.Add(orapamPRENOMEMP);
- OracleParameter orapamSALAIREEMP = new OracleParameter("PSALAIREEMP", OracleDbType.Int32);
- orapamSALAIREEMP.Direction = ParameterDirection.Input;
- orapamSALAIREEMP.Value = TB_Prenom.Text;
- oraAjout.Parameters.Add(orapamSALAIREEMP);
- OracleParameter orapamCODEDEP = new OracleParameter("PCODEDEP", OracleDbType.Char);
- orapamCODEDEP.Direction = ParameterDirection.Input;
- orapamCODEDEP.Value = TB_Prenom.Text;
- oraAjout.Parameters.Add(orapamCODEDEP);
- oraAjout.ExecuteNonQuery();
- }
- catch(Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement