当前位置: 代码迷 >> ASP.NET >> CS0143: 类型“System.Data.OracleClient.OracleDataReader”未定义构造函数,该如何解决
  详细解决方案

CS0143: 类型“System.Data.OracleClient.OracleDataReader”未定义构造函数,该如何解决

热度:7760   发布时间:2013-02-25 00:00:00.0
CS0143: 类型“System.Data.OracleClient.OracleDataReader”未定义构造函数
运行程序时,出现了题目中的错误
错误行在 :OracleDataReader odr = new OracleDataReader();
请大家帮忙解决啊!!! 

using System;
using System.Collections;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Data.OracleClient;
using System.Drawing;
using System.Web;
using System.Web.Security;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;

public partial class _Default : System.Web.UI.Page
{
  protected void ButtonLogin_Click(object sender, EventArgs e)
  {
  string sUserID, sPassword, sUserName, sUserLvl, sCompany;

  //增加了对于验证码得判断 2007-3-1 congcong
  string sConfirmCode,sSessionConfirmCode;
  sConfirmCode = TextBoxConfirmCode.Text;
  sSessionConfirmCode = Session["ConfirmCode"].ToString();
  if (sConfirmCode != sSessionConfirmCode)
  {
  Response.Redirect("错误报告.aspx?ErrorCode=验证码输入错误!请返回,重新输入");
  }

  // 增加代码结束 2007-3-1 congcong

  sUserID = TextBoxUserID.Text;
  sPassword = TextBoxUserPassword.Text;

  LabelWelcome.Text = sUserID;
  string sConnectionString, sSelectCommand;

  sConnectionString = ConfigurationManager.ConnectionStrings["OraConnectionString"].ConnectionString;
  OracleConnection MyConnection = new System.Data.OracleClient.OracleConnection(sConnectionString);

  sSelectCommand = "scott.P_CHECK_USER_PASSWORD";
  OracleCommand MyCommand = new OracleCommand();
  MyCommand.Connection = MyConnection;
  MyCommand.CommandText = sSelectCommand;
  MyCommand.CommandType = CommandType.StoredProcedure;

  MyCommand.Parameters.Add("vUserID", OracleType.VarChar).Value = sUserID;
  MyCommand.Parameters.Add("vUserPassword", OracleType.VarChar).Value = sPassword;
  MyCommand.Parameters.Add("vUserlvl", OracleType.VarChar, 1).Direction = ParameterDirection.Output;
  MyCommand.Parameters.Add("CountUser", OracleType.Number).Direction = ParameterDirection.Output;
  MyCommand.Parameters.Add("vUserName", OracleType.VarChar, 20).Direction = ParameterDirection.Output;
  MyCommand.Parameters.Add("vCompany", OracleType.VarChar, 20).Direction = ParameterDirection.Output;

  MyCommand.Connection.Open();
  MyCommand.ExecuteNonQuery();

  if (Convert.ToInt32(MyCommand.Parameters["CountUser"].Value) == 0)
  {
  Response.Redirect("错误报告.aspx?ErrorCode=5");
  return;
  }
  else if (MyCommand.Parameters["CountUser"].Value == null)
  {
  Response.Redirect("错误报告.aspx?ErrorCode=6");
  return;
  }
  else if (Convert.ToInt32(MyCommand.Parameters["CountUser"].Value) != 1)
  {
  Response.Redirect("错误报告.aspx?ErrorCode=不可预知的错误");
  return;
  }

  sUserName = MyCommand.Parameters["vUserName"].Value.ToString();
  sCompany = MyCommand.Parameters["vCompany"].Value.ToString();
  sUserLvl = MyCommand.Parameters["vUserlvl"].Value.ToString();
  LabelWelcome.Text = "欢迎你光临XXXXXXXX:" + sUserName;
  相关解决方案