Beispiel #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     // Instantiate_all_tables();
     try
     {
         using (conn = new OracleConnection(CONNECTION_STRING))
         {
             //deschiderea conexiunii
             conn.Open();
             //Comenzi_SQL.ExecuteOracleCommand(Comenzi_SQL.DropClientTable(), conn);
             //Comenzi_SQL.ExecuteOracleCommand(Comenzi_SQL.CreateClientTable(), conn);
             string sqlCommand1 = Comenzi_SQL.CreateClientiTable();
             string sqlCommand  = "SELECT * from client";
             using (OracleDataAdapter oda = new OracleDataAdapter(sqlCommand, conn))
             {
                 // Utilizare DataAdapter pentru a seta datele intr-un DataTable
                 DataTable dt = new DataTable();
                 oda.Fill(dt);
                 // setare dataSource pentru controld grid
                 dataGridView1.DataSource = dt;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString());
     }
     finally
     {
         conn.Dispose();
     }
 }
Beispiel #2
0
 private void Instantiate_all_tables()
 {
     try
     {
         using (conn = new OracleConnection(CONNECTION_STRING))
         {
             //deschiderea conexiunii
             conn.Open();
             Comenzi_SQL.ExecuteOracleCommand(Comenzi_SQL.CreateCategorieTable(), conn);
             MessageBox.Show("CreateCategorieTable a fost creata");
             Comenzi_SQL.ExecuteOracleCommand(Comenzi_SQL.CreateClientiTable(), conn);
             MessageBox.Show("CreateClientiTable a fost creata");
             Comenzi_SQL.ExecuteOracleCommand(Comenzi_SQL.CreateClientTable(), conn);
             MessageBox.Show("CreateClientTable a fost creata");
             Comenzi_SQL.ExecuteOracleCommand(Comenzi_SQL.CreateComenziTable(), conn);
             MessageBox.Show("CreateComenziTable a fost creata");
             Comenzi_SQL.ExecuteOracleCommand(Comenzi_SQL.CreateDetalii_ComandaTable(), conn);
             MessageBox.Show("CreateDetalii_ComandaTable a fost creata");
             Comenzi_SQL.ExecuteOracleCommand(Comenzi_SQL.CreateLista_ProduseTable(), conn);
             MessageBox.Show("CreateLista_ProduseTable a fost creata");
             Comenzi_SQL.ExecuteOracleCommand(Comenzi_SQL.CreateProdusTable(), conn);
             MessageBox.Show("CreateProdusTable a fost creata");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString());
     }
     finally
     {
         conn.Dispose();
     }
 }