C# ';提供程序与Oracle Client';的版本不兼容;。我该怎么办?Oracle 19.4.0

C# ';提供程序与Oracle Client';的版本不兼容;。我该怎么办?Oracle 19.4.0,c#,oracle,C#,Oracle,我已经在一个C#Web应用程序上工作了一段时间,目的是从表中提取值并将其显示在列表框中。但是,一旦我运行这个程序,它就会在第37行抛出一个异常: System.TypeInittalizationException: 'The type initializer for 'Oracle.DataAccess.Client.OracleConnection' threw an exception.' Inner Exception OracleException: The provider is

我已经在一个C#Web应用程序上工作了一段时间,目的是从表中提取值并将其显示在列表框中。但是,一旦我运行这个程序,它就会在第37行抛出一个异常:

System.TypeInittalizationException: 'The type initializer for 
'Oracle.DataAccess.Client.OracleConnection' threw an exception.'
Inner Exception
OracleException: The provider is not compatible with the version of
Oracle Client
我一直在互联网上寻找可能的解决方案,但它们都非常过时,而且我还没有找到任何修复方法(我相对较新,对Oracle缺乏经验)

这是代码。任何帮助都将不胜感激

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using Oracle.ManagedDataAccess;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;

namespace Employee_Web_3
{
    public partial class FirstWebPage : System.Web.UI.Page
    {
        int MAX;
        List<string> save_vector = new List<string>();
        List<string> line_vector = new List<string>();
        List<string> singled_vector = new List<string>();

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e) //Pull Values
        {
            MAX = int.Parse(Value_Count.Text);
            if (MAX <= 0)
            {
                Failure_Notice.Visible = true;
                Failure_Notice.Text = "Enter in a number greater than 0!";
            }
            else
            {
                string constr = "User Id=USER; Password=PASSWORD; Data Source=ORACLE DATABASE; enlist=false; pooling=false";
                OracleConnection conn = new OracleConnection(constr); //This is where the exception is being thrown
                conn.Open();

                OracleCommand cmd = new OracleCommand();
                cmd.Connection = conn;

                string line = MAX.ToString();

                cmd.CommandText = "select (employee_fname || ', ' || employee_lname || ' ' || employee_id) from Employee where employee_id <= " + line;
                cmd.CommandType = CommandType.Text;
                OracleDataReader dr = cmd.ExecuteReader();

                while (dr.Read())
                {
                    E_List.Items.Add(dr.GetString(0));
                }

                for (int i = 0; i < E_List.Items.Count; i++)
                {
                    save_vector.Add(E_List.Items[i].ToString());
                    line_vector.Add(E_List.Items[i].ToString());
                }

                conn.Dispose();

                E_List.Visible = true;
                Pull_Values.Visible = false;
                Value_Count.Visible = false;
                Failure_Notice.Visible = false;
                Prompt_.Visible = false;

            }
        }
    }
}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用System.Web;
使用System.Web.UI;
使用System.Web.UI.WebControl;
使用系统数据;
使用Oracle.ManagedDataAccess;
使用Oracle.DataAccess.Client;
使用Oracle.DataAccess.Types;
命名空间Employee_Web_3
{
公共部分类第一个网页:System.Web.UI.Page
{
int MAX;
列表保存向量=新列表();
列表行_向量=新列表();
List singled_vector=新列表();
受保护的无效页面加载(对象发送方、事件参数e)
{
}
受保护的无效按钮1\u单击(对象发送者,事件参数)//拉取值
{
MAX=int.Parse(Value\u Count.Text);
如果(MAX您的代码

using Oracle.ManagedDataAccess;
using Oracle.DataAccess.Client;
using Oracle.DataAccess.Types;
Oracle.ManagedDataAccess
不同于
Oracle.DataAccess
,也许这一个有助于:

通常情况下,两种方法都使用是没有意义的,只能使用其中一种

看起来您安装了一些东西。请检查实际加载的DLL:

conn.GetType().Assembly.Location
conn.GetType().Assembly.FullName
如果是
Oracle.DataAccess
请仔细将其与您的Oracle客户端版本进行比较,两者必须完全匹配


还可以看看这个:

什么是连接字符串?连接字符串中的驱动程序是问题所在。您应该使用绑定变量编写语句。