日期:2014-05-20  浏览次数:20694 次

求一个编辑文件的例子!
如题:查数据库,返回结果遍历。保存到TXT文件当中,创建文件写完了,接下来有点懵,请高手解决下或者有相关的文章贴出来下,不胜感激。

------解决方案--------------------
结果的保存的格式是什么?
Java code

    public static void saveResult(ResultSet set, String filePath) {
        PrintWriter out = null;
        try {
            out = new PrintWriter(filePath);
            while(set.next())
            {
//                String xxx = set.getString(columnLabel);  //TODO 自己写
//                String yyy = set.getString(columnLabel);  //TODO 自己写
                
//                out.println(xxx + yyy);
                out.flush();
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            if (out != null) {
                out.close();
                out = null;
            }
        }
    }

------解决方案--------------------
探讨

结果的保存的格式是什么?
Java code

public static void saveResult(ResultSet set, String filePath) {
PrintWriter out = null;
try {
out = new PrintWriter(filePath);
wh……