标题:Access 提交问题??
只看楼主
luyihuaa5201
Rank: 2
等 级:论坛游民
帖 子:254
专家分:10
注 册:2007-3-25
结帖率:66.67%
 问题点数:0 回复次数:1 
Access 提交问题??
我写了程序,先往Access中插入一条数据,然后在查询数据。但插入成功了,就是查询不出来,我知道是插入后没有提交,请问Access操作后怎么提交??以下是我的代码:请问该怎么加哈???
    package test;

public class Dao {
    
    public int  insert(Bean user){
        int flag = 0 ;
        ContinueAccess access = new ContinueAccess();
        String sql = "insert into t_user values ('"+user.getId()+"','"+user.getName()+"')" ;
        System.out.println(sql);
        try {
            flag = access.update(sql);
        } catch (Exception e) {
            // TODO: handle exception
        }    finally{
            
            access.close();
        }
        return flag ;
    }
    public int find(){
        int flag = 0 ;
        ContinueAccess access = new ContinueAccess();
        String sql = "select * from t_user " ;
        System.out.println(sql);
        
        try {
            flag = access.update(sql);
        } catch (Exception e) {
            // TODO: handle exception
        }    finally{
            access.close();
        }
        return flag ;
    }
    public static void main(String[] args) {
        
        Bean user = new Bean();
        user.setId("004");
        user.setName("黄盛");
        Dao dao = new Dao();
        dao.insert(user);
        dao.find();
    }

}
搜索更多相关主题的帖子: Access user sql insert 
2008-03-20 10:21
luyihuaa5201
Rank: 2
等 级:论坛游民
帖 子:254
专家分:10
注 册:2007-3-25
得分:0 
怎么没有人回答我呀
2008-03-20 17:37



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-204344-1-1.html




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

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