您的位置:程序门 -> java -> web 开发



jsp中应用access的问题!!!急


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


jsp中应用access的问题!!!急
发表于:2007-03-21 20:24:11 楼主
请问如何在jsp中控制access   进行   update   delete

例如从一个页面接受数据

到jsp中   更改数据   或者删除数据   怎么做啊???

另外   以下的程序是修改代码   那里有错?

已经从第一个html页里post   这些数据到这个jsp里

<%@       page       contenttype= "text/html;       charset=gb2312 "       language= "java "       import= "java.sql.* "       errorpage= " "       %>      

    <html>      
    <head>      
    <meta       http-equiv= "content-type "       content= "text/html;       charset=gb2312 ">      
    <title> post </title>      
    </head>      
       
    <body>      
    <%      
       
    class.forname( "sun.jdbc.odbc.jdbcodbcdriver ");      
       
    connection       con=drivermanager.getconnection( "jdbc:odbc:db ");      
       
    statement       stmt=con.createstatement();       request.setcharacterencoding( "gbk ");
   
    string       shuid=request.getparameter( "shuid ");        

    string       lei=request.getparameter( "lei ");  
   
    string       shu_name=request.getparameter( "shu_name ");
 
    string       dingjia=request.getparameter( "dingjia ");  
 
    string       zhuozhe=request.getparameter( "zhuozhe ");  
 
    string       banshe=request.getparameter( "banshe ");    
         
    stmt.EXECuteupdate( "update   tushumingxi   set   shuid= ' "+shuid+ " ',leiid= ' "+lei+ " ',shu_name= ' "+shu_name+ " ',dingjia= ' "+dingjia+ " '
,zhuozhe= ' "+zhuozhe+ " ',banshe= ' "+banshe+ " '   where   shuid= ' "+shuid+ " '   ");


     
    resultset       rs=stmt.EXECutequery( "select   shuid,lieid,shu_name,dingjia,zhuozhe,banshe   from   tushumingxi ");      
       
    while(rs.next())      
    {          
    %>
    <p> <strong> 修改成功     </strong>
    <p>
        <%          
    }      
       
    //       cleanup       resources      
       
  rs.close();      
    stmt.close();      
    con.close();      
       
       
    %>      
    </body>      
    </html>
发表于:2007-03-21 20:28:231楼 得分:0
fasdfasdf
发表于:2007-03-21 20:31:192楼 得分:0
。。。
发表于:2007-03-21 20:40:053楼 得分:0
该回复于2007-12-28 11:53:30被管理员或版主删除


快速检索

最新资讯
热门点击