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


C# OleDbConnectionStringBuilder.Remove方法代码示例

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


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

示例1: EnumerateCatalogs

        private void EnumerateCatalogs()
        {
            // Perform the enumeration
            DataTable dataTable = null;
            OleDbConnection connection = null;
            try
            {
                // Create a connection string without initial catalog
                OleDbConnectionStringBuilder builder = new OleDbConnectionStringBuilder(Properties.ToFullString());
                builder.Remove("Initial Catalog");

                // Create a connection
                connection = new OleDbConnection(builder.ConnectionString);

                // Open the connection
                connection.Open();

                // Try to get the DBSCHEMA_CATALOGS schema rowset
                dataTable = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Catalogs, null);
            }
            catch
            {
                dataTable = new DataTable();
                dataTable.Locale = System.Globalization.CultureInfo.InvariantCulture;
            }
            finally
            {
                if (connection != null)
                {
                    connection.Dispose();
                }
            }

            // Create the object array of catalog names
            _catalogs = new object[dataTable.Rows.Count];
            for (int i = 0; i < _catalogs.Length; i++)
            {
                _catalogs[i] = dataTable.Rows[i]["CATALOG_NAME"];
            }

            // Populate the initial catalog combo box items (must occur on the UI thread)
            if (Thread.CurrentThread == _uiThread)
            {
                PopulateInitialCatalogComboBox();
            }
            else if (this.IsHandleCreated)
            {
                BeginInvoke(new ThreadStart(PopulateInitialCatalogComboBox));
            }
        }
开发者ID:Ralack,项目名称:EMDRGatherer,代码行数:50,代码来源:OleDBConnectionUIControl.cs

示例2: BulkCopy

        public BulkCopy(OleDbConnection conn)
        {
            OleDbConnectionStringBuilder oleDbStringBuilder = new OleDbConnectionStringBuilder(conn.ConnectionString);
            oleDbStringBuilder.Remove("provider");

            IBulkCopyWrapper bulkCopyWrapper = null;
            switch (conn.Provider)
            {
                case "sqloledb":
                    bulkCopyWrapper = new SqlBulkCopyWrapper(new SqlConnection(oleDbStringBuilder.ConnectionString));
                    break;
                case "oraoledb":
                    bulkCopyWrapper = new OracleBulkCopyWrapper(new OracleConnection(oleDbStringBuilder.ConnectionString));
                    break;
                default: throw new Exception("Not Support OleDbConnection");
            }
        }
开发者ID:piaolingzxh,项目名称:Justin,代码行数:17,代码来源:IBulkCopyWrapper.cs


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