I'm testing connnecting to sql server from another computer. I get a runtime error. See attached picture.
Code work if i run from my computer but not from another user\computer. I'm not sure what the problem is. Could it be that i'm using windows authentication to login to the sqlserver? Should i change authentification mode to sql server login?
I've set up ODBC driver on the other computer and connected successfully. I'm really not sure what i'm missing here. Any help is greatly appreciated.
Code work if i run from my computer but not from another user\computer. I'm not sure what the problem is. Could it be that i'm using windows authentication to login to the sqlserver? Should i change authentification mode to sql server login?
Code:
Private Sub Command0_Click()
Dim cnn As ADODB.Connection
Dim strSQL As String
Dim strName As String
Set cnn = New ADODB.Connection
[COLOR="Red"]cnnStr = "Driver={SQL Server};Server=PC162;Database=AdventureWorks2014;Trusted_Connection=Yes;"[/COLOR]
strName = "Staine"
cnn.Open cnnStr
strSQL = "UPDATE Person.Person SET LastName= '" & strName & "' WHERE BusinessEntityID=10703"
cnn.Execute strSQL
cnn.Close
Set cnn = Nothing
Exit Sub
End Sub
I've set up ODBC driver on the other computer and connected successfully. I'm really not sure what i'm missing here. Any help is greatly appreciated.