CREATE OR REPLACE
FUNCTION xxpos.IS_USER_VALID(
user_name IN VARCHAR,
user_password IN VARCHAR)
RETURN boolean
AS
user_count INTEGER;
BEGIN
SELECT COUNT(*)
INTO user_count
FROM xxpos.service_users
WHERE user_id = user_name
AND user_password = user_password;
IF user_count >0 THEN
return true;
ELSE
return false;
END IF;
END;
我创建了 oracle 函数。我尝试在 C# 我的应用程序中使用它 喜欢:
Oracle.DataAccess.Client.OracleParameter[] parameters = new Oracle.DataAccess.Client.OracleParameter[3];
parameters[0] = new Oracle.DataAccess.Client.OracleParameter("user_name", this.UserName);
parameters[1] = new Oracle.DataAccess.Client.OracleParameter("user_password", this.Password);
parameters[2] = new Oracle.DataAccess.Client.OracleParameter("is_valid",
Oracle.DataAccess.Client.OracleDbType.Object,
System.Data.ParameterDirection.ReturnValue);
using (MyOracleClient myOracleClient = new MyOracleClient())
{
myOracleClient.MyExicuteNonQuery(Command.IsUserValid, parameters);
this.userValid = (bool)parameters[2].Value;
}
但这行不通。Cloud you please enplane me,在 c# 数据库连接中使用参数的正确方法。