看板 java 關於我們 聯絡資訊
(鞠躬) 請問一下 我的java程式裡本來讀取.txt檔都可以 不過最近想要換成.SQL檔 於是我很天真的做出一個SQL檔案後 把我程式讀取.TXT檔的部分都改成.SQL 然後就出現 java.lang.ArrayIndexOutOfBoundsException: 2 at Connections.checkId(Connections.java:213) at CardGame.run(CardGame.java:53) 這讓我意識到原來想換成SQL檔案是困難重重的 請問我需要怎麼解救 ---------------其中一部分------------- String tmpstr3; fw = new FileWriter("user.sql"); bfw = new BufferedWriter(fw); for (int i = 0; i < Allusers.size(); i++) { tmp2 = (SaveUserData) Allusers.elementAt(i); tmpstr3 = tmp2.username + " " + tmp2.password + " " + tmp2.moneycount + " " + tmp2.to + " "; bfw.write(tmpstr3); bfw.flush(); } bfw.close(); fw.close(); --------------------疑問--------------- 請問 new FileWriter這個指令可以讀取SQL嗎??? 還是要讀取SQL檔案需要另外的指令 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 118.169.133.80
TonyQ:sql檔也是txt檔 , 跟檔案格是沒關係 , 是內容不是你預期的. 08/10 05:10
Cookiecs:喔!!了解 08/10 08:29