JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » JDBC/SQL討論區  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to postflat modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 [問題]JSP連結Access
笑傲漿糊





發文: 18
積分: 0
於 2004-10-03 12:10 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
這是我寫的程式
可是我不了解字串位啥有問題
知道的可以說明一下嗎
謝謝
程式碼:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<%@page contentType = "text/html;charset=Big5"%>
<%@page import="java.sql.*"%>
<HTML>
<HEAD><TITLE>通訊錄測試版0.1</TITLE></HEAD>
<BODY>
  <%
  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 
  String str="jdbc:odbc:DRIVER=Microsoft Access Driver (*.mdb);DBQ=C:\testJSP\addr\addr.mdb"; 
  Connection con=DriverManager.getConnection(str);
    
  if(con.isClosed())
    out.println("資料庫已經關閉了!<br>");
  else
    out.println("資料庫正在開啟中!<br>");
    con.close();
  if(con.isClosed())
    out.println("資料庫已經關閉了!");
  else
  out.println("資料庫正在開啟中!");
  %>
</BODY>
 

結果:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Generated servlet error:
    [javac] Compiling 1 source file
 
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\JSP\org\apache\jsp\addr\board_jsp.java:56: illegal escape character
 
An error occurred at line: 11 in the jsp file: /addr/board.jsp
 
Generated servlet error:
    String str="jdbc:odbc:DRIVER=Microsoft Access Driver (*.mdb);DBQ=C:\testJSP\addr\addr.mdb"; 
                                                                                            ^
 
An error occurred at line: 11 in the jsp file: /addr/board.jsp
 
Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\JSP\org\apache\jsp\addr\board_jsp.java:56: illegal escape character
 
An error occurred at line: 11 in the jsp file: /addr/board.jsp
 
Generated servlet error:
    String str="jdbc:odbc:DRIVER=Microsoft Access Driver (*.mdb);DBQ=C:\testJSP\addr\addr.mdb"; 
                                                                                                 ^
2 errors
 
</HTML>


morchory edited on 2004-10-03 14:27
reply to postreply to post
話題樹型展開
人氣 標題 作者 字數 發文時間
3436 [問題]JSP連結Access 笑傲漿糊 1950 2004-10-03 12:10
1927 Re:[問題]JSP連結Access anthonycs 296 2004-10-03 12:34
1858 Re:[問題]JSP連結Access cory 51 2004-10-03 12:35
1821 Re:[問題]JSP連結Access 羽夜 249 2004-10-03 12:41
1970 Re:[問題]JSP連結Access 笑傲漿糊 46 2004-10-05 15:06
1864 Re:[問題]JSP連結Access amy111 70 2004-10-13 14:06
» JWorld@TW »  JDBC/SQL討論區

reply to postflat modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8