JFileChooser的问题已经解决,是我写的myFileFilter类继承错误,但PreparedStatement的setBinaryStream()方法使用仍然出错,提示为,setBinaryStream() cannot be applied at line **
setBinaryStream方法要带参数的,我用过很多次了,没有什么问题的。 setBinaryStream(int parameterIndex, InputStream x, int length) Sets the designated parameter to the given input stream, which will have the specified number of bytes.
能给我一个例子吗,我看一看与我的有什么不同 pstm=con.prepareStatement("insert into doc values(?,?,?)"); pstm.setString(1,fileName); pstm.setString(2,fileType); pstm.setBinaryStream(3,fin,fileLength); fin为FileInputStream 写的很简单的,应该没错误呀
addChoosableFileFilter(new FileFilter(){
public boolean accept(File f) { return true; }
public String description() { return ""; }
}
);
JFileChooser jfc=new JFileChooser();
jfc.addChoosableFileFilter(new myFileFilter());
仅此就出错;
myFileFilter extends FileFilter
setBinaryStream(int parameterIndex, InputStream x, int length)
Sets the designated parameter to the given input stream, which will have the specified number of bytes.
pstm=con.prepareStatement("insert into doc values(?,?,?)");
pstm.setString(1,fileName);
pstm.setString(2,fileType);
pstm.setBinaryStream(3,fin,fileLength);
fin为FileInputStream
写的很简单的,应该没错误呀