find odbc user dsn and system dsn in asp.net detailed discussion in text
-
hi frnds , i made dll that was in Visual Basic 6.0 for convienice i m giving code of dll file ///////////////for retrieving odbc system dsn and User DSN Public Function findDsn() As String Dim sKey(2) As Long 'Dim arr(100) As String Dim strDsn As String Dim i As Integer, j As Integer Dim lResult As Long Dim lResult1 As Long Dim hKeyHandle As Long Dim sSize As Long Dim sName As String * 50 'On Error GoTo errHandler sKey(0) = HKEY_CURRENT_USER sKey(1) = HKEY_LOCAL_MACHINE sSize = 50 For j = 0 To 1 i = 0 lResult = RegOpenKey(sKey(j), "SOFTWARE\ODBC\ODBC.INI", hKeyHandle) lResult1 = 0 Do Until lResult1 <> 0 lResult1 = RegEnumKey(hKeyHandle, i, sName, sSize) If lResult1 = 0 Then If strDsn = "" Then strDsn = sName Else strDsn = strDsn & "," & sName End If End If i = i + 1 Loop Call RegCloseKey(hKeyHandle) Next fillCombo = strDsn End Function //////////////////////////////// after making dll of this visual basic code and then used this dll in vb.net no doubt it worked well but when i used this same code in asp.net it shows only sytem dsn. not showing user dsn. thnx in advance . with regards ashutosh sharma ashutosh@cube-software.com ashu
-
hi frnds , i made dll that was in Visual Basic 6.0 for convienice i m giving code of dll file ///////////////for retrieving odbc system dsn and User DSN Public Function findDsn() As String Dim sKey(2) As Long 'Dim arr(100) As String Dim strDsn As String Dim i As Integer, j As Integer Dim lResult As Long Dim lResult1 As Long Dim hKeyHandle As Long Dim sSize As Long Dim sName As String * 50 'On Error GoTo errHandler sKey(0) = HKEY_CURRENT_USER sKey(1) = HKEY_LOCAL_MACHINE sSize = 50 For j = 0 To 1 i = 0 lResult = RegOpenKey(sKey(j), "SOFTWARE\ODBC\ODBC.INI", hKeyHandle) lResult1 = 0 Do Until lResult1 <> 0 lResult1 = RegEnumKey(hKeyHandle, i, sName, sSize) If lResult1 = 0 Then If strDsn = "" Then strDsn = sName Else strDsn = strDsn & "," & sName End If End If i = i + 1 Loop Call RegCloseKey(hKeyHandle) Next fillCombo = strDsn End Function //////////////////////////////// after making dll of this visual basic code and then used this dll in vb.net no doubt it worked well but when i used this same code in asp.net it shows only sytem dsn. not showing user dsn. thnx in advance . with regards ashutosh sharma ashutosh@cube-software.com ashu
-
hi frnds , i made dll that was in Visual Basic 6.0 for convienice i m giving code of dll file ///////////////for retrieving odbc system dsn and User DSN Public Function findDsn() As String Dim sKey(2) As Long 'Dim arr(100) As String Dim strDsn As String Dim i As Integer, j As Integer Dim lResult As Long Dim lResult1 As Long Dim hKeyHandle As Long Dim sSize As Long Dim sName As String * 50 'On Error GoTo errHandler sKey(0) = HKEY_CURRENT_USER sKey(1) = HKEY_LOCAL_MACHINE sSize = 50 For j = 0 To 1 i = 0 lResult = RegOpenKey(sKey(j), "SOFTWARE\ODBC\ODBC.INI", hKeyHandle) lResult1 = 0 Do Until lResult1 <> 0 lResult1 = RegEnumKey(hKeyHandle, i, sName, sSize) If lResult1 = 0 Then If strDsn = "" Then strDsn = sName Else strDsn = strDsn & "," & sName End If End If i = i + 1 Loop Call RegCloseKey(hKeyHandle) Next fillCombo = strDsn End Function //////////////////////////////// after making dll of this visual basic code and then used this dll in vb.net no doubt it worked well but when i used this same code in asp.net it shows only sytem dsn. not showing user dsn. thnx in advance . with regards ashutosh sharma ashutosh@cube-software.com ashu