private void EventBox_MouseDoubleClick(object sender, MouseEventArgs e) { SelectEvent se = new SelectEvent(); se.ShowDialog(); if (se.DialogResult == DialogResult.Cancel) { return; } common.execSQL("UPDATE statel_events SET eventnum=" + se.returnvalue + " WHERE eventid=" + selectedevent + " AND statel_id=" + selectedstatel); ChangeStatelSelection(); }
private void but_AddEvent_Click(object sender, EventArgs e) { SelectEvent se = new SelectEvent(); se.ShowDialog(); if (se.DialogResult == DialogResult.Cancel) { return; } DataSet ds = common.readSQL("SELECT count(*) from statel_events where statel_id=" + selectedstatel); int nexteventid = 1; if ((Int32)ds.Tables[0].Rows[0][0] > 0) { ds = common.readSQL("SELECT eventid from statel_events WHERE statel_id=" + selectedstatel + " ORDER BY eventid DESC"); nexteventid = ((Int32)ds.Tables[0].Rows[0][0]) + 1; } common.execSQL("INSERT INTO statel_events VALUES (" + nexteventid + "," + selectedstatel + "," + se.returnvalue + ")"); }