您的位置:首页 >> 编程开发 >> Java >> 数据库 >> 正文
数据库 RSS
 

使用JDBC创建数据库对象2

http://www.rdxx.com 01年11月16日 11:07 互联网 我要投稿

关键词: 数据库对象 , JDBC , 创建 , 数据 , 对象 , JDB
返回一个列的数据    results = null;    try {    results =                 new resultSet(dma.getColumns(catalog, null,                         tablename, null));    }    catch (Exception e)   {System.out.println(e.getMessage());}    return results.getMetaData();   }   //--   public String[] getColumnNames(String table)   {   //返回一个列名数组   String[] tbnames = null;   Vector tname = new Vector();   try {   results =                 new resultSet(dma.getColumns(catalog, null,                         table, null));    while (results.hasMoreElements() )       tname.addElement(results.getColumnValue("COLUMN_NAME"));        }   catch (Exception e) {System.out.println(e);}   tbnames = new String[tname.size()];   for (int i=0; i< tname.size(); i++)       tbnames[i] = (String)tname.elementAt(i);   return tbnames;   } //--public String getColumnValue(String table,                         String columnName)   {   //返回给定列的值    String res = null;   try      {      if (table.length()>0)          results =                         Execute("Select " + columnName +                                " from " + table +                                 " order by "+columnName);      if (results.hasMoreElements())         res = results.getColumnValue(columnName);     }   catch (Exception e)   {System.out.println("Column value error" +                columnName+ e.getMessage());}   return res;   }//--   public String getNextValue(String columnName)   {   //

上一页 下一页


 
 
标签: 数据库对象 , JDBC , 创建 , 数据 , 对象 , JDB 打印本文
 
 
  相关资讯
RSS
 
 
 
  热点搜索
 
 
 



Valid XHTML 1.0 Transitional
Copyright ©2005 - 2008 Rdxx.Com,All Rights Reserved
收藏本页
收藏本站