当前位置: 首页>>代码示例>>C#>>正文


C# OleDbConnection.GetType方法代码示例

本文整理汇总了C#中System.Data.OleDb.OleDbConnection.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# OleDbConnection.GetType方法的具体用法?C# OleDbConnection.GetType怎么用?C# OleDbConnection.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Data.OleDb.OleDbConnection的用法示例。


在下文中一共展示了OleDbConnection.GetType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: run

		public void run()
		{
			Exception exp = null;
			IDbConnection ICon = new OleDbConnection();

			try
			{
				BeginCase("check IDbConnection is null");
				Compare(ICon != null, true);
			} 
			catch(Exception ex){exp = ex;}
			finally{EndCase(exp); exp = null;}

			try
			{
				BeginCase("check IDbConnection type");
				Compare(ICon.GetType().FullName ,typeof(OleDbConnection).FullName);
			} 
			catch(Exception ex){exp = ex;}
			finally{EndCase(exp); exp = null;}

			ICon = new OleDbConnection(_ConnectionString);

			try
			{
				BeginCase("check IDbConnection connection string");
				Compare(ICon.ConnectionString ,_ConnectionString);
			} 
			catch(Exception ex){exp = ex;}
			finally{EndCase(exp); exp = null;}

			try
			{
				BeginCase("check IDbConnection ConnectionTimeout");
				Compare(ICon.ConnectionTimeout ,15);
			} 
			catch(Exception ex){exp = ex;}
			finally{EndCase(exp); exp = null;}

			try
			{
				BeginCase("check IDbConnection state - closed");
				Compare(ICon.State ,ConnectionState.Closed);
			} 
			catch(Exception ex){exp = ex;}
			finally{EndCase(exp); exp = null;}

			ICon.Open();

			try
			{
				BeginCase("check IDbConnection - open");
				Compare(ICon.State ,ConnectionState.Open );
			} 
			catch(Exception ex){exp = ex;}
			finally{EndCase(exp); exp = null;}

			try
			{
				BeginCase("check IDbConnection CreateCommand");
				IDbCommand cmd = ICon.CreateCommand();
				Compare(cmd.GetType().FullName ,typeof(OleDbCommand).FullName);
			} 
			catch(Exception ex){exp = ex;}
			finally{EndCase(exp); exp = null;}

			if (ICon.State == ConnectionState.Open) ICon.Close();

		}
开发者ID:nlhepler,项目名称:mono,代码行数:69,代码来源:IDBConnection_For_OleDb.cs

示例2: openConnection

 /// <summary>
 /// 
 /// </summary>
 /// <param name="connectionName">Name of connection (should be held in sources connections collection) to be opened
 /// and placed in openConnections if not already there.  (If it is already there then nothing is done)</param>
 /// <returns></returns>
 private void openConnection(RRConnectionString connection)
 {
     if (openConnections.ContainsKey(connection.Name))
         // Have already opened that connection, do nothing
         return;
     else
     {
         var connString = buildConnectionString(connection.Name);
         try
         {
             /*
             // Have not yet opened that connection, so open it and save to collection
              if (connection.DatabaseType == DatabaseType.Teradata)
             {
                 var openConnection = new TdConnection(connString);
                 openConnection.Open();
                 openConnections.Add(connection.Name, openConnection);
             }
             else
             {
             */
             var openConnection = new OleDbConnection(connString);
             openConnection.Open();
             var connType = openConnection.GetType();
             openConnections.Add(connection.Name, openConnection);
         }
         catch (Exception ex)
         {
             throw new ApplicationException(string.Format("Error trying to open connection with {0}: {1}.", connString, getFullErrorMessage(ex)));
         }
     }
 }
开发者ID:karmamule,项目名称:ReconRunner,代码行数:38,代码来源:RRDataService.cs


注:本文中的System.Data.OleDb.OleDbConnection.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。