登录到使用Oracle 10g Express Edition的ASP.NET Web应用程序时出错 [英] Error while logging into asp.net web application that uses oracle 10g express edition

查看:67
本文介绍了登录到使用Oracle 10g Express Edition的ASP.NET Web应用程序时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到的错误是:
试图以与数组不兼容的类型访问元素".
我试图在Windows Server 2003中部署asp.net Web应用程序.我的应用程序使用oracle 10g快捷版.

我已在Windows 7和Windows XP中成功部署了该应用程序.但是它在Windows Server 2003中失败.在该服务器(Windows Server 2003)中,已经安装了oracle 8i.
我在同一服务器上安装了oracle 10g Express版本,并尝试部署我的应用程序.问题是我无法登录该应用程序.抛出的异常是试图以与数组不兼容的类型访问元素"..

要登录的代码是:

The error I encountered is :
"attemped to access an element as a type incompatible with the array".
I tried to deploy asp.net web application in windows server 2003. My aplication uses oracle 10g express edition.

I successfully deployed the application in windows 7 and windows xp. But it failed in windows server 2003. In that server(windows server 2003), oracle 8i was already installed.
I installed oracle 10g Express edition in the same server, and tried todeploy my application. The problem is I could not login into that application. the exception thrown is "attemped to access an element as a type incompatible with the array".

The code to login is:

public static ATTUserLogin GetUserLogin(string userName, string password,int ApplID)
      {
          string LoginSP = "SP_LOGIN";

          List<OracleParameter> paramArray = new List<OracleParameter>();

          paramArray.Add(Utilities.GetOraParam(":p_user_name", userName.Trim(), OracleDbType.Varchar2, ParameterDirection.Input));
          paramArray[0].Size = 10;
          paramArray.Add(Utilities.GetOraParam(":p_password", password.Trim(), OracleDbType.Varchar2, ParameterDirection.Input));
          paramArray[1].Size = 10;
          paramArray.Add(Utilities.GetOraParam(":P_message", null, OracleDbType.Varchar2, ParameterDirection.Output));
          paramArray[2].Size = 50;

          paramArray.Add(Utilities.GetOraParam(":P_Org_ID", null, OracleDbType.Int64, ParameterDirection.Output));
          paramArray.Add(Utilities.GetOraParam(":P_Org_Name", null, OracleDbType.Varchar2, ParameterDirection.Output));
          paramArray[4].Size = 100;
          paramArray.Add(Utilities.GetOraParam(":P_Org_Address", null, OracleDbType.Varchar2, ParameterDirection.Output));
          paramArray[5].Size = 300;
          paramArray.Add(Utilities.GetOraParam(":P_ID", null, OracleDbType.Double, ParameterDirection.Output));

          //paramArray.Add(Utilities.GetOraParam(":P_RC", null, OracleDbType.RefCursor, ParameterDirection.Output));

          GetConnection GetConn = new GetConnection();
          GetConnection GetConn1 = new GetConnection();

          try
          {
              OracleConnection DBConn = GetConn.GetDbConn();
              SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, LoginSP, paramArray.ToArray());

              ATTUserLogin user = new ATTUserLogin();
              user.UserMessage = paramArray[2].Value.ToString();
              user.OrgID = int.Parse(paramArray[3].Value.ToString());
              user.OrgName = paramArray[4].Value.ToString();
              user.OrgAddress = paramArray[5].Value.ToString();
              user.PID = (paramArray[6].Value == System.DBNull.Value) ? 0 : double.Parse(paramArray[6].Value.ToString());

              List<OracleParameter> paramArray1 = new List<OracleParameter>();
              paramArray1.Add(Utilities.GetOraParam("p_emp_id", user.PID, OracleDbType.Int16, ParameterDirection.Input));
              paramArray1.Add(Utilities.GetOraParam("p_rc", null, OracleDbType.RefCursor, ParameterDirection.InputOutput));
              OracleConnection DBConn1 = GetConn1.GetDbConn(Module.PMS);
              DataTable tbl = SqlHelper.ExecuteDataset(DBConn1, CommandType.StoredProcedure, "sp_get_user_unit", paramArray1.ToArray()).Tables[0];

              if (tbl.Rows.Count == 1)
              {
                  user.UnitID = int.Parse(tbl.Rows[0][0].ToString());
                  user.UnitName = tbl.Rows[0][1].ToString();
              }


              return user;
          }
          catch (Exception ex)
          {
              throw ex;
          }
          finally
          {
              GetConn.CloseDbConn();
              GetConn1.CloseDbConn();
          }
      }

推荐答案

似乎您正在重新发明轮子,Oracle提供了标准的asp.net提供程序,该提供程序使用标准的(通常是首选的)机制与asp.net集成在一起:
用于ASP.NET的Oracle提供程序 [
Seems like you are reinventing the wheel, Oracle provides standard asp.net providers that’s integrated with asp.net using the standard, usually preferred, mechanisms:
Oracle Providers for ASP.NET[^]

Now that you have installed Oracle 10 Express on a server running Oracle 8i - I really hope you had permission to do so from the administrator.

I would sincerely recommend going over what''s available with Oracle 8i - chances are you are not using any features not available with 8i - you can always use a different client setup, as Oracle allows you to connect to Oracle 8i using the Oracle 9,10 or even 11 oci client.

Regards
Espen Harlinn


这篇关于登录到使用Oracle 10g Express Edition的ASP.NET Web应用程序时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆