Topic: 存储过程出错了,请高手指点!! |
Print this page |
1.存储过程出错了,请高手指点!! | Copy to clipboard |
Posted by: kingmax2004 Posted on: 2005-07-05 13:42 1、 在SQLSERVER2000里建了这样的一个存储过程: CREATE proc test_pro1 @checkname varchar(50), @checkpasswd varchar(50) as select * from check_person1 where check_name=@checkname and check_passwd=@checkpasswd GO 2、在JSP里的程序的: <% String url="jdbc:odbc:user_person"; String userID="sa"; String userPW="admin"; String username; Connection Db; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Db=DriverManager.getConnection(url,userID,userPW); try { String usern="bb"; String userp="bbbb"; String sql="{CALL test_pro1 (?,?)}"; CallableStatement cstatement=Db.prepareCall(sql); cstatement.registerOutParameter(1,a); cstatement.registerOutParameter(2,b); cstatement.execute(); username=cstatement.getString("user_name"); out.print(username); cstatement.close(); } catch(SQLException error) { out.print("ERROR"); } Db.close(); %> 2、 我的意思是:这是一个用户登录验证的程序,如果用户名与密码都正确就把字段:user_name 的值取出,保存在String 的 username变量里!!谢谢! |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |