GudniGSigurdsson
Thu Mar 15 11:49:20 CDT 2007
Hi Dough.
This is my code where I set up the connection and then try to pull a table:
// The database file.
private string strDBFile = @"MyDocuments\AdvstAflestur.sdf";
// The local connection string.
private string strConnLocal =
"Data Source=" + @"My Documents\AdvstAflestur.sdf";
// The remote connection string.
private string strConnRemote = "Provider=SqlOleDb; " +
"Data Source=Gardar\\Sqlexpress; " +
"Initial Catalog=AdvstAflestur; " +
"Integrated Security = True;";
// The URL
private string strURL = "
http://Gardar/AdveitaDataSync/sscesa20.dll";
And the Pull operation:
private void mitemPull_Click(object sender, EventArgs e)
{
// Create a remote data access object
SqlCeRemoteDataAccess rdaNW =
new SqlCeRemoteDataAccess(strURL, strConnLocal);
try
{
rdaNW.LocalConnectionString = strConnLocal;
rdaNW.InternetUrl = strURL;
rdaNW.InternetLogin = "";
rdaNW.InternetPassword = "";
rdaNW.Pull("Visits",
"SELECT vNr, sNr, Dags, Timi, Lesari FROM Visits",
strConnRemote, RdaTrackOption.TrackingOnWithIndexes,
"ErrorCategories");
}
catch( SqlCeException exSQL )
{
//HandleSQLException(exSQL);
ShowErrors(exSQL);
}
finally
{
rdaNW.Dispose();
}
etc.
I get the message:
Error Code: 80070057
Autentication failed on the computer running IIS
Minor Err.: 28011
Thank you for looking into my problem, Dough.
Regards,
Gudni
"Doug" wrote:
> Hi Gudni.
>
> It might help us figure out where your program is going wrong if you post your code. I use something like this to create a database on the moblie device, connect to the SQL server and pull data down to the device:
>
> Dim rda As SqlCeRemoteDataAccess = Nothing
> Dim strSQL As String
>
> 'Create a new database
> Dim sqlEngine As New SqlCeEngine("Data Source=\My Documents\YourMobileDBName.sdf")
>
> sqlEngine.CreateDatabase()
>
> 'Connect to SQL 2000
> Dim rdaOleDbConnectString As String = "Provider=sqloledb; Data Source=DBServerName;InitialCatalog=DBName;User Id=DBUser;Password=DBUserPassword
>
> 'create an RDA object to connect to the SQL Server CE database on the mobile device:
> ' Initialize the RDA object.
> Try
> rda = New SqlCeRemoteDataAccess
>
> rda.InternetUrl =
http://192.168.1.88/sqlce/sscesa20.dll
> rda.LocalConnectionString = "Provider=Microsoft.SQLSERVER." & _
> "OLEDB.CE.2.0;Data Source=\My Documents\YourMobileDBName.sdf"
> rda.InternetLogin = IISLogin
> rda.InternetPassword = IISPassword
>
> 'Pull from SQL 2000
> strSQL = "SELECT logon, password from users with (nolock) "
> rda.Pull("Users", strSQL, rdaOleDbConnectString, _
> RdaTrackOption.TrackingOff)
>
> Catch err As SqlCeException
> MsgBox(oUtility.ComposeSqlErrorMessage(err))
> '//If any error occurs then clear the database
> End Try
>
>
> EggHeadCafe.com - .NET Developer Portal of Choice
>
http://www.eggheadcafe.com
>