还是VB调用oracle的存储过程的问题!
我已经按照这里http://community.csdn.net/Expert/TopicView3.asp?id=4634977
最后楼的方法调用了存储过程,但结果就是死活不对!。。。
代码如下
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim cmd As New ADODB.Command, i As Integer
Private Sub Command1_Click()
cmd.CommandType = adCmdStoredProc
cmd.CommandText = "PKG_check.checkpwd"
cmd.Parameters.Append cmd.CreateParameter("inputname", adLongVarChar, adParamInput, 20, Trim(Text1.Text))
cmd.Parameters.Append cmd.CreateParameter("inputpwd", adLongVarChar, adParamInput, 20, Trim(Text2.Text))
rs.CursorType = adOpenStatic
rs.LockType = adLockReadOnly
Set rs = cmd.Execute(Null, Null, adCmdStoredProc)
If rs.RecordCount > 0 Then
MsgBox "登陆成功", vbInformation, "yes"
Else
MsgBox "登陆失败", vbCritical, "Erro"
End If
'Set rs = Nothing
Set cmd = Nothing
Set con = Nothing
End Sub
Private Sub Form_Load()
Set con = New ADODB.Connection
con.ConnectionString = "Provider=MSDAORA.1;Password=111 ;User ID=student;Persist Security Info=false;Data Source=LAB101"
con.Open
cmd.ActiveConnection = con
End Sub
存储过程如下
create or replace package PKG_check is
type rc_class is ref cursor;
procedure checkpwd(inputname in varchar2,inputpwd in varchar2,ResultCursor out rc_class);
end PKG_check;
create or replace package body PKG_check
as
procedure checkpwd(inputname in varchar2,inputpwd in varchar2,ResultCursor out rc_class)
IS
BEGIN
open ResultCursor for
select count(*) from users where username=inputname and password=inputpwd;
end;
end PKG_check;
现在就是在text2理输入用户名,text2里输入密码,然后调用checkpwd这存储过程去验证密码,但输入正确的用户名和密码却是返回错误的信息。。怎么回事