📄 getdbtkey.java
字号:
package boco.DBManager.Tree;//******************************************************************************//:功能:从DBTable表中取得当前表的关键字//:时间:2002-07//:作者:王建宾//:特殊描述::test:为DEBUG时启用//:程序描述:////******************************************************************************import java.util.*;import java.sql.*;import boco.shabank.dbconnection.*;public class getDBTKey { //定义变量 String Key; String Tid; ResultSet rs; String sql; Vector theKey; DBConnectionManager objDBConnection; Connection m_Connection; DBAccess db; //构造函数,初始化变量 public getDBTKey() { db=new DBAccess(); sql=""; Key=null; rs=null; Tid = ""; theKey=null; } //返回关键字名称 public void getKey(String DBTName){ int index=0; String tmpKey=""; theKey=new Vector(); sql="select * from dbtable where dbtname='" + DBTName + "'"; //:test:System.out.println(sql); objDBConnection = objDBConnection.getInstance() ; try{ m_Connection = objDBConnection.getConnection("access") ; rs = db.executeQuery(m_Connection,sql) ; if(rs.next()){ Tid=rs.getString(1); Key=rs.getString(6); } tmpKey=Key; if(Key!=null){ //解析Key字符串,取出多个关键字 while(tmpKey!=null&&!tmpKey.trim().equals("")){ index = tmpKey.indexOf(","); if(index==-1){ theKey.addElement(tmpKey.trim()); tmpKey=null; } else{ theKey.addElement(tmpKey.substring(0,index)); tmpKey=tmpKey.substring(index+1); //:test:System.out.println("tmp Key:"+tmpKey); } } } //断开连接,释放资源 //:test:System.out.println("the Key:"+theKey); rs.close() ; objDBConnection.freeConnection("access",m_Connection) ; } catch(Exception e){ System.out.print("errorMsg=" + e.getMessage()) ; } } //取得数据表键值 public Vector getKey(){ return theKey; } public String getTid(){ return Tid; } //测试主程序 public static void main(String[] args){ getDBTKey dbtk = new getDBTKey(); String vTName="acc94"; dbtk.getKey(vTName); Vector Key=dbtk.getKey(); System.out.println("Key="+Key) ; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -