Guest User

Untitled

a guest
Aug 7th, 2018
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.48 KB | None | 0 0
  1. Getting the Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'
  2. Imports API.Database
  3. Public Class DatabaseHelper
  4.  
  5. Private _SqlServer As SQLServer
  6.  
  7. Public Sub New()
  8. End Sub
  9.  
  10. Public ReadOnly Property SqlServer() As SQLServer
  11. Get
  12. If Me._SqlServer Is Nothing Then
  13. Me._SqlServer = New API.Database.SQLServer("192.168.1.3", "sa", "xxxxx", "xxxxxx_xxxxxx_xxxxxx")
  14. End If
  15. Return Me._SqlServer
  16. End Get
  17. End Property
  18.  
  19. End Class
  20.  
  21.  
  22.  
  23. Public Sub New(ByVal server As String, ByVal username As String, ByVal password As String, ByVal database As String)
  24. If server = "" Then
  25. server = "(local)"
  26. //server = "localhost"
  27. End If
  28. If username = "" Then
  29. username = "sa"
  30. End If
  31.  
  32.  
  33.  
  34. Dim connectionString As String = String.Format("Data Source={0};Initial Catalog={3};Integrated Security=True;Persist Security Info=False;User ID={1};Password={2};", server, username, password, database)
  35. //''''''Dim connectionString As String = String.Format("Data Source={0};Initial Catalog={3};User ID={1};Password={2};", server, username, password, database)
  36.  
  37.  
  38. //''Dim connectionString As String = ConfigurationManager.ConnectionStrings("chatterconnectionstring").ConnectionString
  39. Try
  40. Me._SQLConnection = New SqlConnection(connectionString)
  41. Me._SQLConnection.Open()
  42. Catch ex As Exception
  43. If True Then
  44. Throw ex
  45. End If
  46. End Try
  47. End Sub
Add Comment
Please, Sign In to add comment