E
Edward V. Dolikian
I've been trying to get up to speed on Remote Data Access / Replication. It
seems that I have a "Server Side Connection or configuration" problem and
looking for ideas on how to isolate/correct the problem. At this point, I
am simply trying to use RDA and the Pull method to retrieve a data table and
its contents from the Server SQL database.
I did create an ASP.NET Windows application against the same SQL database on
the server and was able to populate a datagrid on my desktop application. I
double checked my connection settings paramters on the connection string on
my desktop (e.g. Provider, Data Source, User ID, Password) and they do match
my device settings (see code below).
I am able to test that the SQL Agent on my device is connecting to the
sscesa20.dll on my web server. When I navigate to the address, I do get a
response back.
Somewhere in between, the connection is not happening. I have attempted to
turn off / minimize security but no doubt this is where my problem lies.
Ultimately, I recongize that you must use security but for the time being, I
just want to get it working. Is there any way to debug / test / trace what
is happening on the server? Is there a command I can issue to ask me to
login so I can check if I am connecting that is more generic? How should
should SQL Server be configured for authenticaiton? I think I have it
configured to use SQL and Windows Authentication.
Any ideas / suggestions would be much appreciated.
Ed
I am using the sample in Rob Tiffany's book on SQL CE Database Development.
Here is a sample of my code. I have substituted / blanked out certain
fields but hopefully this gives you an idea. Net result is that I get a
blank database on my device with no tables and thus no data. I do get a
SQLCEExeption message box with no message. On subsequent attempts, I get an
error on the DROP Table statement because it wasn't created in the first
place.
Dim cn As SqlCeConnection
Dim rda As SqlCeRemoteDataAccess
Dim sqlengine As SqlCeEngine
Try
btnPull.Enabled = False
' Create Database if it doesn't already exist
If Not File.Exists("\My Documents\Intelligencedata.sdf") Then
sqlengine = New SqlCeEngine
sqlengine.LocalConnectionString = "Data Source=\My
Documents\IntelligenceData.sdf; Password=apress; Encrypt Database=true"
sqlengine.CreateDatabase()
sqlengine.Dispose()
Else
' Open the connection to the database
cn = New SqlCeConnection("Data Source=\My
Documents\IntelligenceData.sdf;password=apress")
cn.Open()
Dim cmd As SqlCeCommand = cn.CreateCommand
' Drop the FieldMemos table
cmd.CommandText = "DROP TABLE fieldmemos"
cmd.ExecuteNonQuery()
' Close the connection
If cn.State <> ConnectionState.Closed Then
cn.Close()
End If
End If
' Instantiate the RDA Object
rda = New SqlCeRemoteDataAccess
' Connection to the SQL Server
Dim remoteconnectionstring As String = "Provider=SQLOLEDB;Data
Source=SENSIBLE;Initial Catalog=IntelligenceData;User ID=sa;Password=xxxyyy"
rda.InternetUrl = "http://xx.yy.zzz.xx/ssce20/sscesa20.dll"
rda.LocalConnectionString = "Data Source=\My
Documents\IntelligenceData.sdf;SSCEatabase Password=apress"
rda.Pull("FieldMemos", "Select * from FieldMemos", remoteconnectionstring,
RdaTrackOption.TrackingOnWithIndexes, "FieldMemosErrorTable")
Catch Sqlex As SqlCeException
Dim sqlerror As SqlCeError
For Each sqlerror In Sqlex.Errors
MessageBox.Show(sqlerror.Message)
Next
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
rda.Dispose()
btnPull.Enabled = True
End Try
End Sub
seems that I have a "Server Side Connection or configuration" problem and
looking for ideas on how to isolate/correct the problem. At this point, I
am simply trying to use RDA and the Pull method to retrieve a data table and
its contents from the Server SQL database.
I did create an ASP.NET Windows application against the same SQL database on
the server and was able to populate a datagrid on my desktop application. I
double checked my connection settings paramters on the connection string on
my desktop (e.g. Provider, Data Source, User ID, Password) and they do match
my device settings (see code below).
I am able to test that the SQL Agent on my device is connecting to the
sscesa20.dll on my web server. When I navigate to the address, I do get a
response back.
Somewhere in between, the connection is not happening. I have attempted to
turn off / minimize security but no doubt this is where my problem lies.
Ultimately, I recongize that you must use security but for the time being, I
just want to get it working. Is there any way to debug / test / trace what
is happening on the server? Is there a command I can issue to ask me to
login so I can check if I am connecting that is more generic? How should
should SQL Server be configured for authenticaiton? I think I have it
configured to use SQL and Windows Authentication.
Any ideas / suggestions would be much appreciated.
Ed
I am using the sample in Rob Tiffany's book on SQL CE Database Development.
Here is a sample of my code. I have substituted / blanked out certain
fields but hopefully this gives you an idea. Net result is that I get a
blank database on my device with no tables and thus no data. I do get a
SQLCEExeption message box with no message. On subsequent attempts, I get an
error on the DROP Table statement because it wasn't created in the first
place.
Dim cn As SqlCeConnection
Dim rda As SqlCeRemoteDataAccess
Dim sqlengine As SqlCeEngine
Try
btnPull.Enabled = False
' Create Database if it doesn't already exist
If Not File.Exists("\My Documents\Intelligencedata.sdf") Then
sqlengine = New SqlCeEngine
sqlengine.LocalConnectionString = "Data Source=\My
Documents\IntelligenceData.sdf; Password=apress; Encrypt Database=true"
sqlengine.CreateDatabase()
sqlengine.Dispose()
Else
' Open the connection to the database
cn = New SqlCeConnection("Data Source=\My
Documents\IntelligenceData.sdf;password=apress")
cn.Open()
Dim cmd As SqlCeCommand = cn.CreateCommand
' Drop the FieldMemos table
cmd.CommandText = "DROP TABLE fieldmemos"
cmd.ExecuteNonQuery()
' Close the connection
If cn.State <> ConnectionState.Closed Then
cn.Close()
End If
End If
' Instantiate the RDA Object
rda = New SqlCeRemoteDataAccess
' Connection to the SQL Server
Dim remoteconnectionstring As String = "Provider=SQLOLEDB;Data
Source=SENSIBLE;Initial Catalog=IntelligenceData;User ID=sa;Password=xxxyyy"
rda.InternetUrl = "http://xx.yy.zzz.xx/ssce20/sscesa20.dll"
rda.LocalConnectionString = "Data Source=\My
Documents\IntelligenceData.sdf;SSCEatabase Password=apress"
rda.Pull("FieldMemos", "Select * from FieldMemos", remoteconnectionstring,
RdaTrackOption.TrackingOnWithIndexes, "FieldMemosErrorTable")
Catch Sqlex As SqlCeException
Dim sqlerror As SqlCeError
For Each sqlerror In Sqlex.Errors
MessageBox.Show(sqlerror.Message)
Next
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
rda.Dispose()
btnPull.Enabled = True
End Try
End Sub