CassidyHunt
IS-IT--Management
I am trying to log into a local SQL Server database I have created on my machine. I kept everything pretty much default for sa no password that sort of thing. I can log into other database instances that I setup early no problem. This one just does not seem to work.
I get
Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.
Here is my code
Thanks
Cassidy
I get
Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection.
Here is my code
Code:
Private Function GetEmployeePhoto() As String
Dim EmployeePhotoPath As String
Dim i As Integer
Dim cn As New System.Data.SqlClient.SqlConnection("Server=INTEL925-01;Database=LNH;UID=sa;PWD=;Trusted_Connection=no")
Dim cm As New System.Data.SqlClient.SqlCommand
Dim sda As New System.Data.SqlClient.SqlDataAdapter(cm)
Dim ds As New System.Data.DataSet
cm.CommandText = "GetRandomEmployeePhoto"
cm.CommandType = Data.CommandType.StoredProcedure
cm.Connection = cn
Try
sda.Fill(ds, "WebTemp")
i = CInt(ds.Tables("WebTemp").Rows(0).Item("id").ToString)
Catch ex As Exception
Throw ex
End Try
cm.CommandText = "Select EmployeePhotoLocation from EmployeePhotos where EmployeeID = " & i
cm.CommandType = Data.CommandType.Text
Try
sda.Fill(ds, "EmployeePhotoPath")
EmployeePhotoPath = ds.Tables("EmployeePhotoPath").Rows(0).Item("EmployeePhotoLocation").ToString
Catch ex As Exception
Throw ex
End Try
Return EmployeePhotoPath
End Function
Thanks
Cassidy