C#和Oracle数据库连接 [英] C# and Oracle database connection

查看:82
本文介绍了C#和Oracle数据库连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有一个开发人员使用的项目

Hello i have a project which the developer uses

conn1 = new OleDbConnection("Provider=MSDAORA; Data Source=example;User ID=test;Password=test;Unicode=True");
        conn1.Open();

我与该提供程序MSDAORA有问题 而且我认为它已经老了 因此,我想使用另一种无需MSDAORA的简单解决方案连接到我的数据库.

I have problem with that provider MSDAORA and i think it's old So i want to Connect to my database with another easy solution without MSDAORA.

谢谢

推荐答案

尝试使用Oracle提供程序,添加对System.Data.OracleClient程序集的引用

Try with Oracle provider, add reference to System.Data.OracleClient assembly

在此示例中使用OracleConnection

use OracleConnection as in this example

string connectionString = "...";
using (OracleConnection connection = new OracleConnection(connectionString))
{
    connection.Open();
    using(OracleCommand command = new OracleCommand(your query))
    {
       command.Connection = connection;
       command.ExecuteNonQuery();
    }
}

这篇关于C#和Oracle数据库连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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