看板 java 關於我們 聯絡資訊
※ 引述《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