我是oracle和c#的初学者,我想在c#中使用简单的应用程序使用oracle数据库,我写这个连接字符串来连接数据库:
conn.ConnectionString = "Data Source=BEHBEHZAD;User ID=SYSTEM;Password=beh1368421";
我的完整代码是这样的:
OracleConnection conn = new OracleConnection();
conn.ConnectionString = "Data Source=BEHBEHZAD;User ID=SYSTEM;Password=beh1368421";
try
{
conn.Open();
conn.Close();
MessageBox.Show("Connect Successfull!!");
}
catch (Exception )
{
MessageBox.Show("Disconnect!!");
}
但是当我运行该程序时,我得到Disconnect Message,我的TNS文件详细信息如下:
BEHBEHZAD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = behbehzad)
)
)
我该如何解决?谢谢。