對於我的C#應用程序,我需要連接到oracle數據庫。我一直使用相同的連接,並與其他應用程序完美配合。添加了我一直使用的相同的參考:Oracle.DataAcces在Visual Studio中未打開連接
這是這個問題,我不知道如何解決它。
類型的異常「Oracle.DataAccess.Client.OracleException」發生Monime_V2.0.dll但在用戶代碼中沒有處理
其他信息:外部組件引發的異常。
這是我用來連接:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
// Oracle
using Oracle.DataAccess.Types;
using Oracle.DataAccess.Client;
namespace Monime_V2._0
{
public class Database
{
protected OracleConnection conn;
public OracleConnection Conn
{
get
{
return this.conn;
}
}
public Database()
{
//dbconnectie
this.conn = new OracleConnection();
string pcn = "dbi284945"; //login
string pw = "HGD7dh8daa"; //password
this.conn.ConnectionString = "User Id=" + pcn + ";Password=" + pw + ";Data Source=" + "//192.168.15.50:1521/fhictora" + ";";
}
這裏去理解錯了:
private List<Account> GetListAccounts()
{
List<Account> listA = new List<Account>();
string sql = "select * from MT_ACCOUNT";
OracleCommand cmd = new OracleCommand(sql, this.conn);
try
{
this.conn.Open(); // <-- This line of code sends me to the exception catcher
OracleDataReader reader = cmd.ExecuteReader();
例外說什麼?你想讓我們*猜你的問題是什麼? – nvoigt
你能否在Catch()函數內部放置一個斷點並查看異常? – Eru
我發佈在我的問題的第一個quotet塊是我得到的。所以是的,我希望你們能猜到問題可能是什麼 – JustMo06