本文整理汇总了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));
}
}
示例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");
}
}