在VB.NET中调用存储过程,获取返回值时遇到问题,高分紧急求助!!
sg163 2007-11-28 09:37:44 存储过程:
create or replace procedure login
(v_personcode in t_otms_user.personcode%type,v_password in t_otms_user.password%type,returnvalue out boolean)
as
num number(1);
begin
select count(*) into num from t_otms_user
where t_otms_user.personcode = v_personcode and t_otms_user.password = v_password;
if num = 0 then
returnvalue := false;
dbms_output.put_line(num);
else
returnvalue := true;
dbms_output.put_line(num);
end if;
end login;
VB.NET调用语句:
Dim con As OleDbConnection = New OleDbConnection("Provider=MSDAORA.1;Password=otms;User ID=otms;Data Source=orcl")
con.Open()
Dim cmd As OleDbCommand = New OleDbCommand("login", con)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.Add("v_personcode", SqlDbType.Int).Value = TextBox1.Text
cmd.Parameters.Add("v_password", SqlDbType.Int).Value = TextBox2.Text
cmd.Parameters.Add("returnvalue", SqlDbType.Int)
cmd.Parameters("returnvalue").Direction = ParameterDirection.Output
Dim valueend As Boolean
valueend = cmd.Parameters("returnvalue").Value
If valueend = True Then
Dim MainFrm As New MainFrm
MainFrm.Show()
Me.Hide()
Else
MsgBox("用户名或密码错误,请重试。", MsgBoxStyle.Exclamation, "错误信息")
End If
con.Close()
现在问题是我不管怎么输用户名和密码,返回的值都是TRUE,请问各位高手哪里出问题了?