ODBC连接数据库

 1 Example
 2 {
 3     LoginProperty  LP = new LoginProperty(); 
 4     OdbcConnection myConnection; 
 5     Statement      myStatement; 
 6     ResultSet      myResult; 
 7     ;
 8     super();
 9     LP.setDSN("MSAccess2000");
10     try 
11     {
12       //Do something 
13     }
14     catch 
15     { 
16       info("Check username/password.");
17       return; 
18     }
19     myStatement = myConnection.createStatement();
20     myResult = myStatement.executeQuery("SELECT Title FROM Employees");
21     while (myResult.next())
22        print myResult.getString(1);
23 }
posted @ 2012-08-30 11:32  Sprite.z  Views(162)  Comments(0Edit  收藏  举报