My exploit environment:
VS.net 2003, SQL Server 2000 SP4, SQL Server CE 2.0 SP4
I write next codes:
Private cn As New SqlCeConnection("data source=\my documents\SQLCECF.sdf")
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
If Not System.IO.File.Exists("\my documents\SQLCECF.sdf") Then
Dim en As New SqlCeEngine("data source=\my documents\SQLCECF.sdf")
en.CreateDatabase() 'create a blank database to subscribe
Synch()
End If
Catch err As SqlCeException
ShowErrors(err)
Catch err As Exception
MsgBox("There was an error:" & err.ToString())
End Try
End Sub
Sub Synch()
Try
Dim rep As SqlCeReplication = New SqlCeReplication
With rep
.Publisher = "192.168.0.222"
.PublisherDatabase = "CFLab"
.PublisherLogin = "sa"
.PublisherPassword = "sa"
.Publication = "CFLab"
.Subscriber = "SQLCENETCF"
.SubscriberConnectionString = "Provider=Microsoft.SQLServer.OLEDB.CE.2.0;Data Source=\My Documents\SQLCECF.sdf"
.InternetUrl = "http://192.168.0.222/SQLCE/sscesa20.dll"
' Create the Local SSCE Database subscription
rep.AddSubscription(AddOption.CreateDatabase)
rep.Synchronize() 'subscribe
End With
Catch err As SqlCeException
ShowErrors(err)
Finally
End Try
End Sub
Public Sub ShowErrors(ByRef e As SqlCeException)
Dim errorCollection As SqlCeErrorCollection = e.Errors
Dim bld As System.Text.StringBuilder = New System.Text.StringBuilder
Dim inner As Exception = e.InnerException
If Not inner Is Nothing Then
MessageBox.Show(("Inner Exception:" & inner.ToString()))
End If
For Each err As SqlCeError In errorCollection
bld.Append("/n Error Code: " + err.HResult.ToString("X", System.Globalization.CultureInfo.CurrentCulture))
bld.Append("/n Message : " + err.Message)
bld.Append("/n Minor Err.: " + err.NativeError.ToString())
bld.Append("/n Source : " + err.Source)
For Each numPar As Int32 In err.NumericErrorParameters
If 0 <> numPar Then
bld.Append("/n Num. Par. : " + numPar.ToString())
End If
Next
For Each errPar As String In err.ErrorParameters
If String.Empty <> errPar Then
bld.Append("/n Err. Par. : " + errPar)
End If
Next errPar
MessageBox.Show(bld.ToString())
bld.Remove(0, bld.Length)
Next err
End Sub
Private Sub btnShow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnShow.Click
connect()
Dim query As String = "select * from FlightData"
Dim dap As New SqlCeDataAdapter(query, cn)
Dim dataset1 As New DataSet
dap.Fill(dataset1, "FlightData")
Disconnect()
End Sub
Sub connect()
Synch()
Try
cn.Open()
Catch err As SqlCeException
ShowErrors(err)
End Try
End Sub
Sub Disconnect()
Try
cn.Close()
Catch err As SqlCeException
ShowErrors(err)
End Try
End Sub
Private Sub dgdResults_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dgdResults.Click
End Sub
End Class
I want to synchronize the data from a SQLCE SERVER 2000
When i run the code above, the errors show:
Error Code:80045058
Message:Initializing SQL Server Reconciler has failed.
Error Code:80045058
Message:The course can't load "SSCE" Merge Replication program。please check the module wether enroll correctly.(probable description)
I do not know what's going wrong..=(
Who can help me?!!! HELP~~~~~~~~~
thanks..
Move to Sql Server Compact Edition forum.
Thanks!
|||Please provide the exact error message, see here for instructions on how to get all error information:
http://msdn2.microsoft.com/en-us/library/ms174079.aspx
|||I already used the error objectsuse and listed the error information above :
Error Code:80045058
Message:Initializing SQL Server Reconciler has failed.
Error Code:80045058
Message:The course can't load "SSCE" Merge Replication program。please check the module wether enroll correctly.(probable description)
and I do not know what's going wrong
help!
|||You should also get a native error number (5 digits), please list this, and the proper english text for this:
The course can't load "SSCE" Merge Replication program。please check the module wether enroll correctly.(probable description)
|||
I use the SQL CE of Chinese Edition, so I don't know the proper english text for that.
the text list above is which I translate into English.
thanks
|||I still do not see the native error and the error source (although it appears to be in your ShowErrors code)|||hi, eric zhang, I met a same problem with. and NATIVE_ERROR: 29045
I'm a chinese too.So, If you have any solution, please let me share with you, thx
No comments:
Post a Comment