Beispiel #1
0
        private void UC_Edit_Auftrag_fill_segel()
        {
            string      sql = "SELECT segel.name AS name, segel.form AS form, CONCAT(CONCAT(stoff.ID,', '),stoff.name) AS Stoff, lieferant.Lieferant AS lieferant, segel.id AS id FROM auftraege_segel INNER JOIN segel ON auftraege_segel.id_segel = segel.id INNER JOIN stoff ON segel.stoff_kennung = stoff.ST_ID INNER JOIN stoff_lieferant ON stoff.ST_ID = stoff_lieferant.ST_ID INNER JOIN lieferant ON stoff_lieferant.L_ID = lieferant.L_ID WHERE auftraege_segel.id_auftrag = " + id;
            OdbcCommand cmd = new OdbcCommand(sql, Connection);

            SQL_methods.Open();
            OdbcDataReader sqlReader = cmd.ExecuteReader();

            while (sqlReader.Read())
            {
                Segel segel = new Segel((string)sqlReader["name"], (string)sqlReader["form"], (string)sqlReader["Stoff"], (string)sqlReader["lieferant"], (int)sqlReader["id"]);
                lBx_segel.Items.Add(segel);
            }
        }
Beispiel #2
0
        private void Btn_add_segel_Click(object sender, EventArgs e)
        {
            if (!Global.Not_filled(tBx_segel_name) && !Global.Not_filled(cBx_segelform) && !Global.Not_filled(cBx_stoff_hersteller) && !Global.Not_filled(cBx_stoff_kennung))
            {
                SQL_methods.SQL_exec(string.Format("INSERT INTO segel (segel.name,segel.form,segel.stoff_hersteller,segel.stoff_kennung)VALUES ('{0}','{1}',{2},{3})", tBx_segel_name.Text, cBx_segelform.Text, cBx_stoff_hersteller.SelectedValue, cBx_stoff_kennung.SelectedValue));

                string      sql = "SELECT * FROM segel ORDER BY segel.id DESC LIMIT 1";
                OdbcCommand cmd = new OdbcCommand(sql, Connection);
                SQL_methods.Open();
                OdbcDataReader sqlReader = cmd.ExecuteReader();
                sqlReader.Read();
                int segel_id = Convert.ToInt32(sqlReader[0]);
                sqlReader.Close();

                Segel segel = new Segel(tBx_segel_name.Text, cBx_segelform.Text, (int)cBx_stoff_hersteller.SelectedValue, (int)cBx_stoff_kennung.SelectedValue, segel_id);
                lBx_segel.Items.Add(segel);
            }
        }