欢迎来到优知文库! | 帮助中心 分享价值,成长自我!
优知文库
全部分类
  • 幼儿/小学教育>
  • 中学教育>
  • 高等教育>
  • 研究生考试>
  • 外语学习>
  • 资格/认证考试>
  • 论文>
  • IT计算机>
  • 法律/法学>
  • 建筑/环境>
  • 通信/电子>
  • 医学/心理学>
  • ImageVerifierCode 换一换
    首页 优知文库 > 资源分类 > DOCX文档下载
    分享到微信 分享到微博 分享到QQ空间

    ACCP7.0S2机试答案.docx

    • 资源ID:374723       资源大小:47.61KB        全文页数:16页
    • 资源格式: DOCX        下载积分:5金币
    快捷下载 游客一键下载
    账号登录下载
    微信登录下载
    三方登录下载: QQ登录
    二维码
    扫码关注公众号登录
    下载资源需要5金币
    邮箱/手机:
    温馨提示:
    快捷下载时,如果您不填写信息,系统将为您自动创建临时账号,适用于临时下载。
    如果您填写信息,用户名和密码都是您填写的【邮箱或者手机号】(系统自动生成),方便查询和重复下载。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP,免费下载
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    ACCP7.0S2机试答案.docx

    ACCP7.0S2机试营业网点查询首先针对题目所示创建数据库BranchesMgrUSEBranchesMgrGOCREATETABLEdbo.Branches(idintIDENTITY(1,1)NOTNULL,bnamenvarchar(50)NOTNULL,cityArealdintNOTNULL,addressnvarchar(100)NOTNULL,telephonenvarchar(50)NOTNULL,)ALTERTABLEdbo.BranchesWITHCHECKADDFOREIGNKEY(cityAreald)REFERENCESdbo.CityArea(id)GOCREATETABLEdbo.CityArea(idintIDENTITY(1,1)NOTNULL,cnamenvarchar(50)NOTNULL,)其次步:向表中添加至少3条数据表1:BranchesidbnamecityArealdaddresstelephoneD海淀XX路支行1海淀区XX路128876543212海淀XX路支行1海淀区XX路XX.876512343东城支行2东城区XX路12号876524314西城支行3西城区XX路38号87652143表2:CityAreaidCname1 海淀2 '7东城3 3西城第三步创建Web项目BranchesMgr第四步:依次创建包名为COm.branches,entity,com.branches,dao,com.Branches,biz,com.Branches,action第五步:创建实体类(在COm.branches,entity中)packagecom.branches,entity;publicclassBranchesprivateintid;privateStringname;privateCitycity;privateStringaddress;privateStringtelephone;publicBranches()super();)publicBranches(intid,Stringname,Citycity,Stringaddress,Stringtelephone)super();this,id=id;this,name=name;this,city=city;this,address=address;this,telephone=telephone;)publicintgetld()returnid;)publicvoidsetld(intid)this,id=id;)publicStringgetName()returnname;)publicvoidsetName(Stringname)this,name=name;)publicCitygetCity()returncity;)publicvoidsetCity(Citycity)this,city=city;)publicStringgetAddress()returnaddress;)publicvoidsetAddress(Stringaddress)this,address=address;)publicStringgetTelephone()returntelephone;)publicvoidSetTelephone(Stringtelephone)this.telephone=telephone;packagecom.branches,entity;publicclassCityprivateintid;privateStringname;publicCity()super();)publicCity(intid,Stringname)super();this,id=id;this,name=name;)publicintgetld()returnid;)publicvoidsetld(intid)this,id=id;)publicStringgetName()returnname;)publicvoidsetName(Stringname)this,name=name;第六步:添加jdbc驱动,创建dao基类用于连接数据库,并创建接口用于实现增删改等功能packagecom.branches,dao;importjava.sql.Connection;importjava.sql.DriverManager;importjava.sql.PreparedStatement;importjava.sql.ResultSet;publicclassBaseDaoprotectedConnectionconn=null;protectedResultSetrs=null;protectedPreparedStatementps=null;获得数据库连接publicvoidgetConnection()throwsExceptionClass,forName(,com.microsoft.sqlserver.jdbc.SQLServerDriver,);conn=DriverManager.getConnection(njdbc:sqlserver:/localhost:1433;DataBaseName=CityDB,wsaw,w123n);)publicResultSetexecuteQuery(Stringsql,Objectparam)throwsExceptionthis.getConnection();ps=conn.prepareStatement(sql);if(param!=null)for(inti=0;i<param,length;i+)ps.SetObject(i+l,parami);)rs=ps.executeQuery();returnrs;)publicintexecuteUpdate(Stringsql,Objectparam)throwsException(this.getConnection();ps=conn.prepareStatement(sql);if(param!=null)for(inti=0;i<param,length;i+)ps.SetObject(i+l,parami);)introws=ps.executeUpdateO;this.CloseReSourceO;returnrows;)释放资源publicvoidCloseReSourceOthrowsExceptionif(ps!=null)ps.closeO;if(rs!=null)rs.close();if(conn!=null)conn,closeO;packagecom.branches,dao;importjava.util.List;importcom.branches,entity.Branches;publicinterfaceBranchesDao1.ist<Branches>getBranches()throwsException;BranchesgetBranche(intid)throwsException;booleanUpdBranches(Branchesbranches)throwsException;booleandelBranches(intid)throwsException;)packagecom.branches,dao;importjava.util.List;importcom.branches,entity.City;publicinterfaceCityDao1.ist<City>getCitys()throwsException;)第七步:编写接口实现类packagecom.branches,dao.impl;importjava.util.ArrayList;importjava.util.List;importcom.branches,dao.BaseDao;importcom.branches,dao.BranchesDao;importcom.branches,entity.Branches;importcom.branches,entity.City;publicclassBrandchesDaoImplextendsBaseDaoimplementsBranchesDaopublicList<Branches>getBranches()throwsExceptionStringsql=,selectc.idascicl,c.nameascname,b.idasbid,b.nameasbname,b.address,b.telephonefromBranchesbinnerjoincityareaconb.CityAreaId=C.idr,;super.executeQuery(sql,null);1.ist<Branches>list=newArrayList<Branches>O;while(rs.next()Branchesbra=newBranches();bra.setld(rs.getlnt(HbidH);bra.setName(rs.getString(Mbnamer,);bra.setAddress(rs.getString(,addressn);bra.SetTelephone(rs.getString(,telephone,f);bra.setCity(newCity(rs.getlnt(r,cidM),rs.getString(,cname,');list,add(bra);)super.CloseReSourceO;returnlist;)publicbooleanUpdBranches(Branchesbranches)throwsExceptionStringsql=wupdatebranchessetname=?,cityareaid=?,address=?,telephone=?whereid=?”;Objectparam=branches.getName(),branches.getCity().getld(),branches.getAddress(),branches.getTelephone(),branches,getld();returnsuper.executeUpdate(sql,param)>0;)publicbooleandelBranches(intid)throwsExceptionStringsql=,deletefrombrancheswhereid=?”;Object口param=id;returnsuper.executeUpd

    注意事项

    本文(ACCP7.0S2机试答案.docx)为本站会员(王**)主动上传,优知文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知优知文库(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于我们 - 网站声明 - 网站地图 - 资源地图 - 友情链接 - 网站客服 - 联系我们

    copyright@ 2008-2023 yzwku网站版权所有

    经营许可证编号:宁ICP备2022001189号-2

    本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。优知文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知优知文库网,我们立即给予删除!

    收起
    展开