本文整理汇总了C#中CUBRID.Data.CUBRIDClient.CUBRIDConnection.CurrentDatabase方法的典型用法代码示例。如果您正苦于以下问题:C# CUBRIDConnection.CurrentDatabase方法的具体用法?C# CUBRIDConnection.CurrentDatabase怎么用?C# CUBRIDConnection.CurrentDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUBRID.Data.CUBRIDClient.CUBRIDConnection
的用法示例。
在下文中一共展示了CUBRIDConnection.CurrentDatabase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_ConnectionProperties
/// <summary>
/// Test CUBRID Connection properties
/// </summary>
private static void Test_ConnectionProperties()
{
using (CUBRIDConnection conn = new CUBRIDConnection())
{
conn.ConnectionString = TestCases.connString;
conn.Open();
Debug.Assert(conn.ConnectionTimeout == 30);
Debug.Assert(conn.CurrentDatabase() == "demodb");
Debug.Assert(conn.Database == "demodb");
Debug.Assert(conn.DbVersion.StartsWith("") == true);
Debug.Assert(conn.DataSource == "test-db-server");
Debug.Assert(conn.AutoCommit == true);
Debug.Assert(conn.LockTimeout == -1);
Debug.Assert(conn.ConnectionTimeout == 30);
Debug.Assert(conn.IsolationLevel == CUBRIDIsolationLevel.TRAN_DEFAULT_ISOLATION);
Debug.Assert(conn.ServerVersion == "");
Debug.Assert(conn.State == ConnectionState.Open);
}
}
示例2: CurrentDatabase_Test
public void CurrentDatabase_Test()
{
using (CUBRIDConnection conn = new CUBRIDConnection())
{
LogTestStep("database name is not specified in the connection string");
try
{
conn.ConnectionString = "server=localhost;port=33000;user=public;password=;charset=utf-8";
conn.Open();
}
catch (Exception ex)
{
Assert.AreEqual("The database name can't be empty!", ex.Message);
LogStepPass();
}
LogTestStep("database name is specified in the connection string");
string expected = DBHelper.dbName;
string actual;
conn.ConnectionString = DBHelper.connString;
conn.Open();
actual = conn.CurrentDatabase();
Assert.AreEqual(expected, actual);
LogStepPass();
}
LogTestResult();
}