Asiakas luokka muokattu, asiakashallinta muokattu, asiakasikkunaan lisätty laskutustiedot välilehti
Signed-off-by: laurimaaninka <lauri.maaninka@gmail.com>
This commit is contained in:
@@ -38,14 +38,16 @@ public class Tietokanta {
|
||||
handleException(e);
|
||||
}
|
||||
|
||||
//Lisää laskutustietokenttä Asiakkaat tauluun
|
||||
try (Connection conn = haeYhteys()) {
|
||||
Statement stmt = conn.createStatement();
|
||||
stmt.execute("alter table asiakkaat add column laskutustieto TEXT");
|
||||
}
|
||||
catch (SQLException e) {
|
||||
if (!e.getMessage().contains("duplicate column name: laskutustieto")) {
|
||||
handleException(e);
|
||||
//Lisää laskutustiedot asiakastauluun
|
||||
String[] sarakkeet = {"laskutusosoite", "yhteyshenkilönNimi", "yhteyshenkilönPuhelinnumero", "yhteyshenkilönSähköposti"};
|
||||
for (String sarake : sarakkeet) {
|
||||
try (Connection conn = haeYhteys()) {
|
||||
PreparedStatement stmt = conn.prepareStatement("alter table asiakkaat add column " + sarake + " varchar(255)");
|
||||
stmt.execute();
|
||||
} catch (SQLException e) {
|
||||
if (!e.getMessage().contains("duplicate column name")) {
|
||||
handleException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user