1
ODBC 연결 대화 상자를 표시하고 선택한 ODBC를 다시 얻는 방법에 대한 정보는 무엇입니까?C# ODBC 대화 상자
ODBC 연결 대화 상자를 표시하고 선택한 ODBC를 다시 얻는 방법에 대한 정보는 무엇입니까?C# ODBC 대화 상자
아무도 대답이없는 것 같으니 까. dbsource를 통해 ODBC 연결을 반복하는 법은 어때? sqlserver 또는 mysql
// a_RootKey is Microsoft.Win32.RegistryKey
// DSN is a class not provided in this code sample - you can see what properties are needed from the usage below.
List<DSN> DsnList = new List<DSN>();
Microsoft.Win32.RegistryKey SearchKey = a_RootKey.OpenSubKey("SOFTWARE\\ODBC\\ODBC.INI\\ODBC Data Sources");
if (SearchKey != null)
{
foreach (string DsnName in SearchKey.GetValueNames())
{
if ((string)SearchKey.GetValue(DsnName) == "SQL Server")
{
Microsoft.Win32.RegistryKey anotherkey = a_RootKey.OpenSubKey("SOFTWARE\\ODBC\\ODBC.INI\\" + DSNName);
DSN dsn = new DSN();
dsn.Name = DSNName;
dsn.Server = (string)anotherkey.GetValue("Server");
dsn.Database = (string)anotherkey.GetValue("Database");
dsn.Driver = (string)anotherkey.GetValue("Driver");
DsnList.Add(dsn);
}
}
}
return DsnList;