"odbccp32.dll" "SQLConfigDataSource" is not working with dsn in windows 7,8.10,11 64bit using dot net

95 Views Asked by At

I am trying to create and delete the ODBC DSN (32/64bit) Windows system. I am using Function= SQLConfigDataSource DLL= "ODBCCP32.DLL"

I am developing an application in the dot net 2.0 framework in "vb.net".

   Dim Attr As String
            'Shell("cmd.exe /c ", AppWinStyle.Hide, False)

            Attr = "SERVER=" & "192.168.0.107" & "" & vbNullChar
            Attr = Attr & "DSN=ERP" & vbNullChar
            Attr = Attr & "DESCRIPTION=DSN For ERP" & vbNullChar
            Attr = Attr & "DATABASE=" & "ERPDEV" & ";uid= " & "edp" & ";pwd=" & "edp" & vbNullChar
            Attr = Attr & "TRUSTED_CONNECTION=no" & vbNullChar
           

            SQLConfigDataSource(0, 6, "SQL Server", Attr) // this code also not working

            If SQLConfigDataSource(0, 4, "SQL Server", Attr) = 1 Then
                Return "SpectrumERPTest" //not coming here 
            Else
                Return "SpectrumERPTest"
            End If

"SQLConfigDataSource" is not deleting and creating the ODBC data source for "SQL Server". I have found that this DLL work for only some window 7 and its version but after that version function stops working.

I am not getting any errors so I can search for it. If anyone faced this kind of issue then help me. or You can suggest me better method to create the ODBC Datasource "User/System" DSN for windows 7 ,8 ,10,11 (32/64 bit).

0

There are 0 best solutions below