- null value.jpg (27.8 KiB) Viewed 1264 times
Hy
I update the latest version, but I have the problem even now.
My code:
- Code: Select all
public void vevoi_lekerdezes_excel(String projekt, String datumtol, String datumig, String lezart, String nyitott)
{
Connection conn = null;
Statement stmt = null;
DataTable datatable = new DataTable();
try
{
try
{
Class.forName("com.mysql.cj.jdbc.Driver");
}
catch (Exception e)
{
System.out.println(e);
String hibauzenet2 = e.toString();
JOptionPane.showMessageDialog(null, hibauzenet2, "Hiba üzenet", 2);
}
conn = DriverManager.getConnection("jdbc:mysql://172.20.22.29", "veasquality", "kg6T$kd14TWbs9&gd");
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
String sql = "";
if(projekt.equals("-"))
{
projekt = "%";
}
if(lezart.equals("igen") && nyitott.equals("igen"))
{
sql = "SELECT * FROM qualitydb.Vevoireklamacio_alapadat where Projekt like '"+ projekt +"' and Datum >= '"+ datumtol
+"' and Datum <= '"+ datumig +"'";
}
else if(lezart.equals("igen") && nyitott.equals("nem"))
{
sql = "SELECT DATE_FORMAT(Datum,'%Y%m'), projekt, rek_vagy, nyitva FROM qualitydb.Vevoireklamacio_alapadat where Projekt like '"+ projekt +"' and Datum >= '"+ datumtol
+"' and Datum <= '"+ datumig +"' and Lezaras_ido is not null group by Projekt";
}
else
{
sql = "SELECT * FROM qualitydb.Vevoireklamacio_alapadat where Projekt like '"+ projekt +"' and Datum >= '"+ datumtol
+"' and Datum <= '"+ datumig +"' and Lezaras_ido is null ";
}
stmt.execute(sql);
resultSet = stmt.getResultSet();
Workbook workbook = new Workbook();
JdbcAdapter jdbcAdapter = new JdbcAdapter();
jdbcAdapter.fillDataTable(datatable, resultSet); // <= Here is the Exception
//Get the first worksheet
Worksheet sheet = workbook.getWorksheets().get(0);
sheet.insertDataTable(datatable, true, 1, 1);
JFileChooser mentes_helye = new JFileChooser();
mentes_helye.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
mentes_helye.showOpenDialog(mentes_helye);
File fajl = mentes_helye.getSelectedFile();
//System.out.println(fajl.getAbsolutePath());
workbook.saveToFile(fajl.getAbsolutePath(), ExcelVersion.Version2016);
resultSet.close();
stmt.close();
conn.close();
And this is the exception:
java.lang.NumberFormatException: For input string: ""
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
at java.base/java.lang.Integer.parseInt(Integer.java:678)
at java.base/java.lang.Integer.valueOf(Integer.java:999)
at com.spire.xls.packages.sprqzba.spr▋╸(Unknown Source)
at com.spire.xls.packages.sprqzba.spr┾╸(Unknown Source)
at com.spire.data.table.DataColumn.spr┾╸(Unknown Source)
at com.spire.data.table.DataRow.setObject(Unknown Source)
at com.spire.data.table.common.JdbcAdapter.fillDataTable(Unknown Source)
at com.spire.data.table.common.JdbcAdapter.fillDataTable(Unknown Source)
at SQL.vevoi_lekerdezes_excel(SQL.java:755)
And this is the data base:
- null value.jpg (27.8 KiB) Viewed 1264 times