-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInformixDataSourceEnumerator.cs
More file actions
73 lines (59 loc) · 2.6 KB
/
InformixDataSourceEnumerator.cs
File metadata and controls
73 lines (59 loc) · 2.6 KB
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System.Data;
using System.Data.Common;
namespace Arad.Net.Core.Informix;
public sealed class InformixDataSourceEnumerator : DbDataSourceEnumerator
{
private const string DATASOURCE_TABLENAME = "InformixDataSources";
private const string DATABASE_SERVER = "IfxDatabaseServer";
private const string HOST_COMPUTER = "HostComputer";
private const string USER_NAME = "UserName";
private const string PASSWORD_OPTION = "PasswordOption";
private const string PASSWORD = "Password";
private const string PROTOCOL = "Protocol";
private const string SERVICE = "Service";
private const string OPTION = "Option";
public static InformixDataSourceEnumerator Instance = new InformixDataSourceEnumerator();
private InformixDataSourceEnumerator()
{
}
public override DataTable GetDataSources()
{
InformixRegEnumerator ifxRegEnumerator = new InformixRegEnumerator();
ifxRegEnumerator.InitInstance();
DataTable dataTable = new DataTable("InformixDataSources");
try
{
DataColumnCollection columns = dataTable.Columns;
columns.Add(new DataColumn("IfxDatabaseServer", typeof(string)));
columns.Add(new DataColumn("HostComputer", typeof(string)));
columns.Add(new DataColumn("UserName", typeof(string)));
columns.Add(new DataColumn("PasswordOption", typeof(string)));
columns.Add(new DataColumn("Password", typeof(string)));
columns.Add(new DataColumn("Protocol", typeof(string)));
columns.Add(new DataColumn("Service", typeof(string)));
columns.Add(new DataColumn("Option", typeof(string)));
DataRow dataRow = null;
InformixDSRecord ifxDSRecord = null;
while ((ifxDSRecord = ifxRegEnumerator.MoveNext()) != null)
{
dataRow = dataTable.NewRow();
dataRow["IfxDatabaseServer"] = ifxDSRecord.InformixServer;
dataRow["HostComputer"] = ifxDSRecord.Host;
dataRow["UserName"] = ifxDSRecord.UserName;
dataRow["PasswordOption"] = ifxDSRecord.PasswordOption;
dataRow["Password"] = ifxDSRecord.Password;
dataRow["Protocol"] = ifxDSRecord.Protocol;
dataRow["Service"] = ifxDSRecord.Service;
dataRow["Option"] = ifxDSRecord.Options;
dataTable.Rows.Add(dataRow);
dataRow.AcceptChanges();
}
dataTable.AcceptChanges();
return dataTable;
}
catch
{
return null;
}
}
}