Exemple #1
0
 private void savebutton_Click(object sender, EventArgs e)
 {
     try
     {
         #region Datenbankschreiben-Fahrtenbuch
         OleDbCommand    cmd;
         OleDbConnection conn;
         string          cmdstr;
         conn = new OleDbConnection(Properties.Settings.Default.DBSConnectionString1);
         if (datumbr && abfahrtortr && zielortr && akmstr && ekmstr)    //Wenn alle Felder Grün sind speichert er erst in die Datenbank
         {
             conn.Open();
             cmdstr = "INSERT INTO Fahrtenbuch (Datum, Abfahrtsort, Zielort, Anfangskmstand, Endkmstand) VALUES ('" + Datumtb.Text + "','" + Abfahrtsorttb.Text + "','" + Zielorttb.Text + "'," + ankmtb.Text + "," + endkmtb.Text + ")";
             cmd    = new OleDbCommand(cmdstr, conn);
             cmd.ExecuteNonQuery();
             conn.Close();
             Fahrtbuch a = new Fahrtbuch(r);
             this.Close();
             a.Show();
         }
         #endregion
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemple #2
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         if (DeleteID.Text != "")
         {
             string          cmdstr = "DELETE FROM Fahrtenbuch WHERE Fahrtid = " + DeleteID.Text;
             OleDbCommand    cmd;
             OleDbConnection conn;
             conn = new OleDbConnection(Properties.Settings.Default.DBSConnectionString1);
             conn.Open();
             cmd = new OleDbCommand(cmdstr, conn);
             cmd.ExecuteNonQuery();
             conn.Close();
             dataGridView1.Update();
             Fahrtbuch a = new Fahrtbuch(r);
             this.Close();
             a.Show();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemple #3
0
        private void Fahrtenbuch_Click(object sender, EventArgs e)
        {
            Fahrtbuch fahrtenbuch = new Fahrtbuch(r);

            fahrtenbuch.Show();
        }