private void vcitajFunkcija(VrabPrometProcent v) { String sql = "select pozicija from izvrshuva where restoran_id= :REST_ID and VRABOTEN_ID= :VRAB_ID"; OracleCommand cmd = new OracleCommand(sql, Conn); try { OracleParameter prm = new OracleParameter("REST_ID", OracleDbType.Int64); prm.Value = this.RestoranID; cmd.Parameters.Add(prm); prm = new OracleParameter("VRAB_ID", OracleDbType.Int64); prm.Value = v.VrabID; cmd.Parameters.Add(prm); cmd.CommandType = CommandType.Text; OracleDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { v.Funkcija = dr.GetString(0); } } catch (Exception ex) { MessageBoxForm mbf = new MessageBoxForm("Настана грешка при поврзувањето со базата!", false); if (mbf.ShowDialog() == DialogResult.Yes) { this.Close(); } else { this.Close(); } } }
public void vcitajTabela() { String sql = getSqlVer2(); OracleCommand cmd = new OracleCommand(sql, Conn); try { OracleParameter prm = new OracleParameter("REST_ID1", OracleDbType.Int64); prm.Value = this.RestoranID; cmd.Parameters.Add(prm); prm = new OracleParameter("MESEC1", OracleDbType.NChar); prm.Value = lblMesec.Text; cmd.Parameters.Add(prm); prm = new OracleParameter("GODINA1", OracleDbType.NChar); prm.Value = lblGodina.Text; cmd.Parameters.Add(prm); prm = new OracleParameter("DATUM1", OracleDbType.Varchar2); prm.Value = lblMesec.Text + "/" + lblGodina.Text; cmd.Parameters.Add(prm); prm = new OracleParameter("REST_ID2", OracleDbType.Int64); prm.Value = this.RestoranID; cmd.Parameters.Add(prm); prm = new OracleParameter("REST_ID3", OracleDbType.Int64); prm.Value = this.RestoranID; cmd.Parameters.Add(prm); prm = new OracleParameter("MESEC2", OracleDbType.NChar); prm.Value = lblMesec.Text; cmd.Parameters.Add(prm); prm = new OracleParameter("GODINA2", OracleDbType.NChar); prm.Value = lblGodina.Text; cmd.Parameters.Add(prm); prm = new OracleParameter("DATUM2", OracleDbType.Varchar2); prm.Value = lblMesec.Text + "/" + lblGodina.Text; cmd.Parameters.Add(prm); prm = new OracleParameter("REST_ID4", OracleDbType.Int64); prm.Value = this.RestoranID; cmd.Parameters.Add(prm); cmd.CommandType = CommandType.Text; OracleDataReader dr = cmd.ExecuteReader(); while (dr.Read()) { int id = dr.GetInt32(0); string ime = dr.GetString(1); string prezime = dr.GetString(2); int promet = dr.GetInt32(3); // lblPromet.Text = String.Format("{0}", dr.GetInt32(4)); decimal procent = dr.GetDecimal(5); VrabPrometProcent v = new VrabPrometProcent(id, ime, prezime, promet, procent); vraboteni.Add(v); } } catch (Exception ex) { MessageBoxForm mbf = new MessageBoxForm("Настана грешка при поврзувањето со базата!", false); if (mbf.ShowDialog() == DialogResult.Yes) { this.Close(); } else { this.Close(); } } }