1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
namespace System.Data.OleDb
{
using System;
using System.Data;
using System.Data.OleDb;
using ADODB;
/// Interop Assembly von COM-Bibliothek: "Microsoft OLE DB Service Component 1.0 Type Library"
using MSDASC;
/// <summary>
/// Bietet Klassen zur Ergänzung des Namespaces System.Data.OleDb
/// </summary>
public static partial class OleDbHelper
{
/// <summary>
/// Öffnet einen Dialog zur Erstellung bzw. Überarbeitung von Connection-Strings,
/// die zur Herstellung von OLEDB-Datenbankverbindungen verwendet werden.
/// </summary>
/// <param name="builder">Übergabe des zu überarbeitenden Connections-Strings.</param>
/// <returns>Liefert das überarbeitete bzw. neue Connection-String.</returns>
public static OleDbConnectionStringBuilder PromptConnection(OleDbConnectionStringBuilder builder)
{
try
{
DataLinks dataLinks = new DataLinksClass();
Connection connection = null;
if (string.IsNullOrEmpty(builder.ConnectionString))
{
connection = (Connection)dataLinks.PromptNew();
return new OleDbConnectionStringBuilder(connection.ConnectionString);
}
connection = new ConnectionClass();
connection.ConnectionString = builder.ConnectionString;
object adoConnection = connection;
if (dataLinks.PromptEdit(ref adoConnection))
{
builder = new OleDbConnectionStringBuilder(connection.ConnectionString);
}
return builder;
}
catch
{
return new OleDbConnectionStringBuilder();
}
}
}
}
|