devxlogo

GetOsqlPath – Get the path of the SQL Server’s OSQL.exe utility

GetOsqlPath – Get the path of the SQL Server’s OSQL.exe utility

' Get the path of the SQL Server's OSQL.exe utilityFunction GetOsqlPath() As String    Dim regKey As Microsoft.Win32.RegistryKey = _        Microsoft.Win32.Registry.LocalMachine.OpenSubKey( _        "SOFTWAREMicrosoftMicrosoft SQL Server80ToolsClientSetup")    If regKey Is Nothing Then        Return ""    End If    Dim osqlPath As String = System.IO.Path.Combine(CType(regKey.GetValue _        ("SQLPath"), String), "Binnosql.exe")    regKey.Close()    Return osqlPathEnd Function

devx-admin

Share the Post: