| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 993 人关注过本帖
标题:NullPointerException
取消只看楼主 加入收藏
yinmingzheng13
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2008-4-13
结帖率:100%
收藏
 问题点数:0 回复次数:0 
NullPointerException

import java.sql.*;
import java.util.*;

class JDBC_test
{
    public static void main(String[] args)
    {
           Connection con ;
        Statement stm ;
        ResultSet rs;
        String url ;
        
        try{
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            
            url = "jdbc:odbc:ymz";
            
            con = DriverManager.getConnection(url);
            
            stm = con.createStatement();
            
            rs = stm.executeQuery("SELECT * FROM sysusers");
            
            while(rs.next())
            {
                Vector vector = new Vector();
                //System.out.println("OK");
                for(int i=0;;i++)
                {
                    vector.addElement(rs.getObject(i+1).toString());
                                                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                }
                //System.out.println("OK");
                //System.out.println(vector);
            }
            
            /*
            while(rs.next())
            {
                //int theInt = rs.getInt("uid");
                String str = rs.getString("createdate");
                System.out.println(str);
            }
            */
        }catch(Exception e){
            e.printStackTrace();
        }
        
    }
}
搜索更多相关主题的帖子: 数据库 Vector 
2008-12-10 16:48
快速回复:NullPointerException
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017000 second(s), 10 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved