作者TonyQ (骨头)
看板java
标题Re: [问题] 资料库资料输出档案?
时间Mon Feb 12 01:24:47 2007
※ 引述《laruku2000 (阿本)》之铭言:
: 我需要从资料库捞资料输出至档案,不过我对java.io给他很不熟~,~,不知程式是那里出错
: ,无法正确输出,请求支援~~
: Class.forName("com.mysql.jdbc.Driver");
: Connection MyConn = DriverManager.getConnection(
: "jdbc:mysql://xxx.xxx.xxx.xxx/xxxx", "xxxxx", "xxxxx");
: Statement s = MyConn.createStatement();
: String sql = "select * from xxxxx";
: ResultSet r = s.executeQuery(sql);
: while (r.next()) {
: PrintWriter abcd = new PrintWriter(new FileWriter("java.txt"),true);
: for (int i = 1; i <= 9; i++) {
: abcd.println(r.getString(i)+",");
: }
: 感觉是蛮简易的功能但我不会写>"<,本来是要印出9个栏位的所有资料逗点隔开输出到txt
: 档的,但完全不行...............Orz
问题不够详细
如果是ERROR的话请附错误讯息
如果是结果不符的话 请说明结果
什麽都没有别人也很难帮你...除非你只是想抱怨...|||
--
String temp="relax"; | Life just like programing
while(buringlife) String.forgot(temp); | to be right or wrong
while(sleeping) brain.setMemoryOut(); | need not to say
stack.push(life.running); | the complier will
stack.push(scouting.buck()); | answer your life
stack.push(bowling.practice()); | Bone
everything
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.134.27.68