Skip to content

Instantly share code, notes, and snippets.

@n0rek
Created April 4, 2018 11:35
Show Gist options
  • Save n0rek/14fcb90eb20a1b7c771ac9685457ad18 to your computer and use it in GitHub Desktop.
Save n0rek/14fcb90eb20a1b7c771ac9685457ad18 to your computer and use it in GitHub Desktop.
List<String[]> rows = new CsvParser(settings).parseAll((fileopen.getSelectedFile()), "UTF-8");
for (String[] row : rows) {
for (String columnValue : row) {
try {
Statement statement = conn.createStatement();
statement.executeUpdate("INSERT INTO dbo.Szyby_temp(Nr_zlec_klienta, Nr_ref_klienta, Szerokosc, Wysokosc, Ilosc, Opis_dodatkowy, Data_importu) "
+ "VALUES (" + "'" + columnValue + "'" + "," + "'" + columnValue + "'" + "," + "'" + columnValue + "'" + "," + "'"
+ columnValue + "'" + "," + "'" + columnValue + "'" + "," + "'" + columnValue + "'" + "," + "getdate())");
} catch (SQLException ex) {
Logger.getLogger(Glass_search.class.getName()).log(Level.SEVERE, null, ex);
JOptionPane.showMessageDialog(null, ex, "ERROR", JOptionPane.ERROR_MESSAGE);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment