我在oracle中有一个表,包含不同的用户名,密码,尝试,同意,管理和锁定日期。 用户名和密码是输入参数,其他的是输出参数。如果数据库中的用户名和密码存在,我必须返回登录状态Y否则N. 另外我需要获得outstarmeter的值,例如,tryss,agree,admin等。当我在oracle中执行存储过程时,输出很好,我无法在C#中填充它。 这是我的代码。 我正在使用asp.net的登录控件(login.aspx)
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
string username = Server.HtmlEncode(Login1.UserName);
string pwd = HttpUtility.HtmlEncode(Login1.Password)
var isUserValid = userbll.ValidateUser(username, pwd, out userInfo);
//calling function to bll.
Userinfo是一个单独的类,包含所有属性(name,pwd,attempt,agree,admin等),我将userinfo作为out参数传递
userBLL.css
public bool ValidateUser(string username, string password, out UserInfo userInfo)
{
string vLoginStatus=dataClass.ValidateUser(username, password, out userInfo);
if (vLoginStatus == "Y")
{
return true;
}
return false;
DLL代码
internal string ValidateUser(string username, string password, out UserInfo userInfo)
{
OracleParameter[] p =
{
OracleHelper.MakeInParam("in_username", OracleDbType.Varchar2, 20, username),
OracleHelper.MakeInParam("in_password", OracleDbType.Varchar2, 32, password),
OracleHelper.MakeOutParam("out_Login_ok", OracleDbType.Varchar2, 1),
OracleHelper.MakeOutParam("out_admin", OracleDbType.Varchar2, 1),
OracleHelper.MakeOutParam("out_agree", OracleDbType.Varchar2, 1),
OracleHelper.MakeOutParam("out_type", OracleDbType.Varchar2, 2),
OracleHelper.MakeOutParam("out_locked", OracleDbType.Varchar2, 1),
OracleHelper.MakeOutParam("out_errornumber", OracleDbType.Int32, 0)
};
OracleHelper.ExecuteNonQuery(OraClientConnectionString,
CommandType.StoredProcedure,
string.Format("{0}.{1}.{2}", Schema, PackageName, "stored proc Name"), p);
var vLoginStatus = ((OracleParameter)p[2]).Value.ToString();
userInfo = new UserInfo
{
Username = username,
Password = password,
Admin = ((OracleParameter)p[3]).Value.ToString(),
Agree = HrOracleHelper.ConvertToBoolean(((OracleParameter)p[4]).Value.ToString()), // hrhelper is just a class to change agree and locekd to boolean
Locked = HrOracleHelper.ConvertToBoolean(((OracleParameter)p[5]).Value.ToString()),
F
};
var errorNumber = ((OracleParameter)p[6]).Value.ToString();
if (Convert.ToInt32(errorNumber) != 0)
{
//Nlog.logerror
return "N";
}
return vLoginStatus;
我的问题是关于已验证用户的数据库登录状态是Y,但是我没有得到它,而且我没有在c#中获得任何outout参数值。如何在c#中获取数据库输出参数值?