Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. find odbc user dsn and system dsn in asp.net detailed discussion in text

find odbc user dsn and system dsn in asp.net detailed discussion in text

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netcomhelp
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SharmaAshutosh
    wrote on last edited by
    #1

    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

    I 2 Replies Last reply
    0
    • S SharmaAshutosh

      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

      I Offline
      I Offline
      Ista
      wrote on last edited by
      #2

      .NET doesnt use DSN's until 2005 1 line of code equals many bugs. So don't write any!!

      1 Reply Last reply
      0
      • S SharmaAshutosh

        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

        I Offline
        I Offline
        Ista
        wrote on last edited by
        #3

        you would want a system DSN anyhow. Web site users can change. systems wont 1 line of code equals many bugs. So don't write any!!

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups