111,094
社区成员




public OracleConnection GetOracleConnection() //在程序中写死连接信息
{
this.serverIp = "localhost";
this.port = "1521";
this.serverName = "TEST";
this.userName = "fym";
this.password = "testtest";
string connectionString = @"Server =(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)" +
"(HOST =" + serverIp + ")(PORT = " + port + "))) (CONNECT_DATA = (SERVICE_NAME =" + serverName + ") ) )" +
";uid=" + userName + ";pwd=" + password + ";Persist Security Info=True";
OracleConnection connection=new OracleConnection(connectionString);
if (connection.State == ConnectionState.Closed)
{
connection.Open();
}
return connection;
}