Re: Login failed for user

From: Andy Sjostrom (andynospam_at_businessanyplace.net)
Date: 05/23/03


Date: Fri, 23 May 2003 16:05:39 +0200


Thanks, Jasper! I continued my quest for the answer on the device side of
things.
In my .NET CF app I did:

Private connectionstring As String = "Data Source=\SalesAnyplace.sdf"

Private remoteconnectionstring As String = "Provider=sqloledb;Data
Source=myserver;Initial Catalog=Northwind;Integrated Security=SSPI;"

Private database As String = "\SalesAnyplace.sdf"

Private internetlogin = "myserver\sqlce"

Private internetpassword = "sqlce"

Private interneturl = http://myserver/sqlce/sscesa20.dll

...

Dim conn As New SqlCeConnection(connectionstring)

Try

conn.Open()

Dim cmd As SqlCeCommand = conn.CreateCommand()

cmd.CommandText = "DROP TABLE Employees"

cmd.ExecuteNonQuery()

Catch err As SqlCeException

Finally

If conn.State = ConnectionState.Open Then conn.Close()

End Try

' Initialize RDA Object.

Dim rda As SqlCeRemoteDataAccess = Nothing

Try

'Try the Pull Operation.

rda = New SqlCeRemoteDataAccess

rda.InternetLogin = internetlogin

rda.InternetPassword = internetpassword

rda.InternetUrl = interneturl

rda.LocalConnectionString = connectionstring

rda.Pull("Employees", "SELECT * FROM Employees", _

remoteconnectionstring, _

RdaTrackOption.TrackingOnWithIndexes, _

"ErrorTable")

Catch err As SqlCeException

MsgBox(err.Message)

Finally

'Dispose of the RDA Object.

rda.Dispose()

End Try

So, I understood it was all about the "Integrated Security=SSPI" statement.
I didn't try it in my regular desktop app. But after seeing your response I
decided to do that too.
And it works like a charm! Hope more people can be helped by all this and
the code above! :-)

Andy Sjostrom
MS MVP - Mobile Devices