private void BtnDeleteInstallatie_Click(object sender, RoutedEventArgs e) { try { string query = "DELETE FROM tblinstallatie WHERE InstallatieID = "; query += ListInstallaties.SelectedValue.ToString().Substring(0, 4); Data d = new Data(myConnectionString); d.DataRemove(query); UpdateLists(); } catch { } }
private void BtnDeleteData_Click(object sender, RoutedEventArgs e) { try { string query = "DELETE FROM "; string ID = ListData.SelectedValue.ToString().Substring(0, 4); switch (selectedAdd) { case "Container": query += "tblcontainer " + "WHERE ContainerID = " + ID; break; case "Device": query += "tbldevice " + "WHERE DeviceID = " + ID; break; case "Event": query += "tblevents " + "WHERE EventID = " + ID; break; case "Persoon": query += "tblpersoon " + "WHERE PersoonID = " + ID; break; } Data d = new Data(myConnectionString); d.DataRemove(query); updateRightList(); } catch { } }