Topic: 急救!!(class conn is public, should be declared in a file named) |
Print this page |
1.急救!!(class conn is public, should be declared in a file named) | Copy to clipboard |
Posted by: panjiandong Posted on: 2004-05-08 10:14 package WebMail; import java.sql.*; public class conn { String sDBDriver = "sun.jdbc.odbc.JdbcOdbcDriver"; String sConnStr = "jdbc:odbc:WebMail"; Connection connect = null; ResultSet rs = null; public conn() { try { Class.forName(sDBDriver); } catch(java.lang.ClassNotFoundException e) { System.err.println( e.getMessage()); } } public ResultSet executeQuery(String sql) { rs = null; try { connect = DriverManager.getConnection(sConnStr); Statement stmt = connect.createStatement(); rs = stmt.executeQuery(sql); } catch(SQLException ex) { System.err.println(ex.getMessage()); } return rs; } }帮我看一下咧 高手!!!!!! 我在DOS 下面运行时显示的错误是conn { 这个地方!!1 |
2.Re:急救!!!!!!!!!!! [Re: panjiandong] | Copy to clipboard |
Posted by: wmgreat Posted on: 2004-05-08 10:50 大哥,重要给点错误信息吧! |
3.Re:急救!!!!!!!!!!! [Re: panjiandong] | Copy to clipboard |
Posted by: panjiandong Posted on: 2004-05-08 13:39 我在DOS 下运行的报错: WebMail\WebMail.java:3: class conn is public, should be declared in a file named conn.java public class conn { ^ 1 error |
4.Re:急救!!!!!!!!!!! [Re: panjiandong] | Copy to clipboard |
Posted by: hone Posted on: 2004-05-08 16:23 估计是名字(大小写?)不符,低级错误................. |
5.Re:急救!!!!!!!!!!! [Re: panjiandong] | Copy to clipboard |
Posted by: tangming Posted on: 2004-05-08 17:07 呵呵,错误很明显么, 文件名 |
6.Re:急救!!!!!!!!!!! [Re: panjiandong] | Copy to clipboard |
Posted by: panjiandong Posted on: 2004-05-09 16:40 谢谢大家 |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |