本文整理汇总了C#中Oracle.DataAccess.Client.OracleConnection.ChangeDatabase方法的典型用法代码示例。如果您正苦于以下问题:C# OracleConnection.ChangeDatabase方法的具体用法?C# OracleConnection.ChangeDatabase怎么用?C# OracleConnection.ChangeDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Oracle.DataAccess.Client.OracleConnection
的用法示例。
在下文中一共展示了OracleConnection.ChangeDatabase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ServerAccessOracle
static ServerAccessOracle()
{
//if (LoggingSystem.LoggingSystem.TraceCode) LoggingSystem.LoggingSystem.LogMessage = "static ServerAccessOracle()";
OracleConnection = getOracleConnection(null);
List<string> databaseNames = new List<string>();
try
{
try
{
string commandString = "show databases ";
OracleCommand OracleCommand = new OracleCommand(commandString, OracleConnection);
/*OracleDataReader myReader = OracleCommand.ExecuteReader();
////if (OracleTrace) SQLView.Log(OracleCommand.CommandText);
while (myReader.Read())
{
if (!string.IsNullOrEmpty(myReader.GetString(0)))
{
databaseNames.Add(myReader.GetString(0));
}
}
myReader.Close();
*/
}
catch (InvalidOperationException ioe)
{
}
}
catch (OracleException retrieveSymbolIndexException)
{
Console.WriteLine("Error: {0}", retrieveSymbolIndexException.ToString());
}
foreach (string database in databaseNames)
{
List<string> tableNames = new List<string>();
try
{
try
{
OracleConnection.ChangeDatabase(database);
getOracleConnection(database);
string commandString = "USE " + database + "; SHOW TABLES ;";
OracleCommand OracleCommand = new OracleCommand(commandString, OracleConnection);
OracleDataReader myReader = OracleCommand.ExecuteReader();
////if (OracleTrace) SQLView.Log(OracleCommand.CommandText);
while (myReader.Read())
{
if (!string.IsNullOrEmpty(myReader.GetString(0)))
{
string tb = myReader.GetString(0);
string DB = myReader.GetString(0);
if (tb.Equals("simbs") || tb.Equals("srel"))
{
tableNames.Add(tb);
}
}
}
myReader.Close();
}
catch (InvalidOperationException ioe)
{
}
}
catch (OracleException retrieveSymbolIndexException)
{
Console.WriteLine("Error: {0}", retrieveSymbolIndexException.ToString());
}
if (tableNames.Contains("simbs") && tableNames.Contains("srel"))
{
GooDBDs.Add(database);
}
}
OracleDB = "SYSTEM";
//if (MyResultsTrace)//SQLView.LogResult(new string[] { name });
}