JButton btnExp = new JButton("Exp");
btnExp.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
try {
String query="SELECT * FROM CustomerInfo";
PreparedStatement pst=connection.prepareStatement(query);
ResultSet rs=pst.executeQuery();
File file = new File("C:\\Users\\Ihusaan Areef\\Desktop\\Something.txt");
rs = pst.executeQuery(query);
/*while (rs.next()) {
int VoucherNo = rs.getInt(1);
String CustomerName = rs.getString(2);
String EnterTime = rs.getString(3);
String LastTime = rs.getString(4);
String Destination = rs.getString(5);
String AirlineCode = rs.getString(6);
String FlightNo = rs.getString(7);
String Date = rs.getString(8);
String Time = rs.getString(9);*/
FileWriter fstream = new FileWriter(file);
BufferedWriter out = new BufferedWriter(fstream);
out.write(rs.getString(query));
/*out.write(rs.getString(2));
out.write(rs.getString(3));
out.write(rs.getString(4));
out.write(rs.getString(5));
out.write(rs.getString(6));
out.write(rs.getString(7));
out.write(rs.getString(8));
out.write(rs.getString(9));*/
out.close();
} catch(Exception fd){
JOptionPane.showMessageDialog(null, fd);
}
}
});
btnExp.setBounds(918, 111, 69, 29);
contentPane.add(btnExp);
I am Getting "not implemented by sqlite jdbc driver" Error when i run the query. Is the query correct or shall i keep on going? i want to export all table information to a text file. I am using Eclipse and sqlite. i have installed all the needed .jar files and imported all the materials.
Aucun commentaire:
Enregistrer un commentaire