karahim
Oct 6th, 2005, 08:36 AM
Hi
I am trying to use RDA for a SmartDeviceApplication, while trying to PULL, it generates error:
Error Code: 80004005
Message : An internal eror occurred..
Minor Err.:28574
Source :Microsoft SQL Server 2000 Windows CE Edition
Environment Development/Database Server machine:
Windowns 2000 (SP4)
VS 2003, VB.NET, CF 1.0 SP3
SQL Server 2000 SP3a
SQL Server CE 2.0
IIS - created a virtual directory named SQLCE, and for SQL CE Server Agent specified HTTP content folder C:\Program Files\Microsoft SQL Server CE 2.0\Server\
ActiveSync 3.7
I am attaching the HTTP Authentication screenshot from IIS configuration, I doubt I am doing something wrong with "Account used for anonymous access"
Environment Pocket PC:
HX2750 HP iPAQ
Windows CE 4.21
ActiveSync 3.7 (cradle/USB)
Imports System.Data.SqlServerCe
Imports System.Text
Imports System.IO
Public Class Form1
Inherits System.Windows.Forms.Form
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
Dim conn As New SqlCeConnection("Data Source=\My Documents\ssce.sdf")
Dim sqlCreateTable As SqlCeCommand = conn.CreateCommand()
' Connection string to SQL Server 2000
Dim rdaOleDbConnectString As String = _
"Provider=sqloledb; Data Source=home-pc;Initial" & _
" Catalog=Attendance;User Id=sa;Password="
' Initialize the RDA object.
Dim rda As SqlCeRemoteDataAccess = Nothing
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
MyBase.Dispose(disposing)
End Sub
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents btnPush As System.Windows.Forms.Button
Friend WithEvents btnPull As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents txtStatus As System.Windows.Forms.TextBox
Private Sub InitializeComponent()
Me.MainMenu1 = New System.Windows.Forms.MainMenu
Me.btnPush = New System.Windows.Forms.Button
Me.btnPull = New System.Windows.Forms.Button
Me.txtStatus = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
'
'btnPush
'
Me.btnPush.Location = New System.Drawing.Point(16, 80)
Me.btnPush.Text = "Push"
'
'btnPull
'
Me.btnPull.Location = New System.Drawing.Point(16, 56)
Me.btnPull.Text = "Pull"
'
'txtStatus
'
Me.txtStatus.Location = New System.Drawing.Point(56, 136)
Me.txtStatus.Size = New System.Drawing.Size(168, 20)
Me.txtStatus.Text = ""
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(8, 136)
Me.Label1.Size = New System.Drawing.Size(40, 16)
Me.Label1.Text = "Status"
'
'Form1
'
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txtStatus)
Me.Controls.Add(Me.btnPull)
Me.Controls.Add(Me.btnPush)
Me.Menu = Me.MainMenu1
Me.Text = "RDA Example"
End Sub
#End Region
Public Sub createDB()
' if database exists, delete it and create a new one
If File.Exists( _
"\My Documents\ssce.sdf") Then
File.Delete("\My Documents\ssce.sdf")
End If
' Create a new database
Dim sqlEngine As New SqlCeEngine( _
"Data Source=" & _
"\My Documents\ssce.sdf")
sqlEngine.CreateDatabase()
txtStatus.Text = "DB Created successfully"
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
createDB()
End Sub
Private Function PullRetrieveRecordsFromSQLServer2000()
Try
rda = New SqlCeRemoteDataAccess
' http://localhost/virtual_directory_alias_name/sscesa20.dll
rda.InternetUrl = "http://home-pc/SQLCE/sscesa20.dll"
rda.LocalConnectionString = _
"Provider=Microsoft.SQLSERVER." & _
"OLEDB.CE.2.0;Data Source=\My Documents\ssce.sdf"
rda.Pull("Module", "Select * from Module", _
rdaOleDbConnectString, _
RdaTrackOption.TrackingOnWithIndexes, _
"ErrorTable")
MsgBox("Pull operation completed", _
MsgBoxStyle.Information, _
"Pull")
txtStatus.Text = "Pull Data to SQLServerCE successfully"
Catch err As SqlCeException
ShowErrors(err)
Finally
rda.Dispose()
End Try
End Function
Public Shared Sub ShowErrors(ByVal e As SqlCeException)
Dim errorCollection As SqlCeErrorCollection = e.Errors
Dim bld As New StringBuilder
Dim inner As Exception = e.InnerException
If Not inner Is Nothing Then
MessageBox.Show(("Inner Exception: " & inner.ToString()))
End If
Dim err As SqlCeError
' Enumerate each error to a message box.
For Each err In errorCollection
bld.Append((ControlChars.Cr & _
" Error Code: " & _
err.HResult.ToString("X")))
bld.Append((ControlChars.Cr & _
" Message : " & _
err.Message))
bld.Append((ControlChars.Cr & _
" Minor Err.: " & _
err.NativeError))
bld.Append((ControlChars.Cr & _
" Source : " & _
err.Source))
' Retrieve the error parameter
' numbers for each error.
Dim numPar As Integer
For Each numPar In err.NumericErrorParameters
If 0 <> numPar Then
bld.Append((ControlChars.Cr & _
" Num. Par. : " & _
numPar))
End If
Next numPar
' Retrieve the error parameters for each error.
Dim errPar As String
For Each errPar In err.ErrorParameters
If [String].Empty <> errPar Then
bld.Append((ControlChars.Cr & _
" Err. Par. : " & _
errPar))
End If
Next errPar
MessageBox.Show(bld.ToString())
bld.Remove(0, bld.Length)
Next err
End Sub
Private Function PushSQLServerCETableDataToSQLServer2000database()
' Initialize the RDA object.
Dim rda As SqlCeRemoteDataAccess = Nothing
Try
rda = New SqlCeRemoteDataAccess
' http://localhost/virtual_directory_alias_name/sscesa20.dll
rda.InternetUrl = "http://home-pc/SQLCE/sscesa20.dll"
rda.LocalConnectionString = _
"Provider=Microsoft.SQLSERVER." & _
"OLEDB.CE.2.0;Data Source=\My Documents\ssce.sdf"
rda.Push("Module", rdaOleDbConnectString, _
RdaBatchOption.BatchingOn)
MsgBox("Push operation completed", _
MsgBoxStyle.Information, "Push")
txtStatus.Text = "Push Data to SQLServer2000 successfully"
Catch err As SqlCeException
ShowErrors(err)
Finally
rda.Dispose()
End Try
End Function
Private Sub btnPull_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPull.Click
PullRetrieveRecordsFromSQLServer2000()
End Sub
Private Sub btnPush_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPush.Click
PushSQLServerCETableDataToSQLServer2000database()
End Sub
End Class
Please advise.
I am trying to use RDA for a SmartDeviceApplication, while trying to PULL, it generates error:
Error Code: 80004005
Message : An internal eror occurred..
Minor Err.:28574
Source :Microsoft SQL Server 2000 Windows CE Edition
Environment Development/Database Server machine:
Windowns 2000 (SP4)
VS 2003, VB.NET, CF 1.0 SP3
SQL Server 2000 SP3a
SQL Server CE 2.0
IIS - created a virtual directory named SQLCE, and for SQL CE Server Agent specified HTTP content folder C:\Program Files\Microsoft SQL Server CE 2.0\Server\
ActiveSync 3.7
I am attaching the HTTP Authentication screenshot from IIS configuration, I doubt I am doing something wrong with "Account used for anonymous access"
Environment Pocket PC:
HX2750 HP iPAQ
Windows CE 4.21
ActiveSync 3.7 (cradle/USB)
Imports System.Data.SqlServerCe
Imports System.Text
Imports System.IO
Public Class Form1
Inherits System.Windows.Forms.Form
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
Dim conn As New SqlCeConnection("Data Source=\My Documents\ssce.sdf")
Dim sqlCreateTable As SqlCeCommand = conn.CreateCommand()
' Connection string to SQL Server 2000
Dim rdaOleDbConnectString As String = _
"Provider=sqloledb; Data Source=home-pc;Initial" & _
" Catalog=Attendance;User Id=sa;Password="
' Initialize the RDA object.
Dim rda As SqlCeRemoteDataAccess = Nothing
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
MyBase.Dispose(disposing)
End Sub
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents btnPush As System.Windows.Forms.Button
Friend WithEvents btnPull As System.Windows.Forms.Button
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents txtStatus As System.Windows.Forms.TextBox
Private Sub InitializeComponent()
Me.MainMenu1 = New System.Windows.Forms.MainMenu
Me.btnPush = New System.Windows.Forms.Button
Me.btnPull = New System.Windows.Forms.Button
Me.txtStatus = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
'
'btnPush
'
Me.btnPush.Location = New System.Drawing.Point(16, 80)
Me.btnPush.Text = "Push"
'
'btnPull
'
Me.btnPull.Location = New System.Drawing.Point(16, 56)
Me.btnPull.Text = "Pull"
'
'txtStatus
'
Me.txtStatus.Location = New System.Drawing.Point(56, 136)
Me.txtStatus.Size = New System.Drawing.Size(168, 20)
Me.txtStatus.Text = ""
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(8, 136)
Me.Label1.Size = New System.Drawing.Size(40, 16)
Me.Label1.Text = "Status"
'
'Form1
'
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.txtStatus)
Me.Controls.Add(Me.btnPull)
Me.Controls.Add(Me.btnPush)
Me.Menu = Me.MainMenu1
Me.Text = "RDA Example"
End Sub
#End Region
Public Sub createDB()
' if database exists, delete it and create a new one
If File.Exists( _
"\My Documents\ssce.sdf") Then
File.Delete("\My Documents\ssce.sdf")
End If
' Create a new database
Dim sqlEngine As New SqlCeEngine( _
"Data Source=" & _
"\My Documents\ssce.sdf")
sqlEngine.CreateDatabase()
txtStatus.Text = "DB Created successfully"
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
createDB()
End Sub
Private Function PullRetrieveRecordsFromSQLServer2000()
Try
rda = New SqlCeRemoteDataAccess
' http://localhost/virtual_directory_alias_name/sscesa20.dll
rda.InternetUrl = "http://home-pc/SQLCE/sscesa20.dll"
rda.LocalConnectionString = _
"Provider=Microsoft.SQLSERVER." & _
"OLEDB.CE.2.0;Data Source=\My Documents\ssce.sdf"
rda.Pull("Module", "Select * from Module", _
rdaOleDbConnectString, _
RdaTrackOption.TrackingOnWithIndexes, _
"ErrorTable")
MsgBox("Pull operation completed", _
MsgBoxStyle.Information, _
"Pull")
txtStatus.Text = "Pull Data to SQLServerCE successfully"
Catch err As SqlCeException
ShowErrors(err)
Finally
rda.Dispose()
End Try
End Function
Public Shared Sub ShowErrors(ByVal e As SqlCeException)
Dim errorCollection As SqlCeErrorCollection = e.Errors
Dim bld As New StringBuilder
Dim inner As Exception = e.InnerException
If Not inner Is Nothing Then
MessageBox.Show(("Inner Exception: " & inner.ToString()))
End If
Dim err As SqlCeError
' Enumerate each error to a message box.
For Each err In errorCollection
bld.Append((ControlChars.Cr & _
" Error Code: " & _
err.HResult.ToString("X")))
bld.Append((ControlChars.Cr & _
" Message : " & _
err.Message))
bld.Append((ControlChars.Cr & _
" Minor Err.: " & _
err.NativeError))
bld.Append((ControlChars.Cr & _
" Source : " & _
err.Source))
' Retrieve the error parameter
' numbers for each error.
Dim numPar As Integer
For Each numPar In err.NumericErrorParameters
If 0 <> numPar Then
bld.Append((ControlChars.Cr & _
" Num. Par. : " & _
numPar))
End If
Next numPar
' Retrieve the error parameters for each error.
Dim errPar As String
For Each errPar In err.ErrorParameters
If [String].Empty <> errPar Then
bld.Append((ControlChars.Cr & _
" Err. Par. : " & _
errPar))
End If
Next errPar
MessageBox.Show(bld.ToString())
bld.Remove(0, bld.Length)
Next err
End Sub
Private Function PushSQLServerCETableDataToSQLServer2000database()
' Initialize the RDA object.
Dim rda As SqlCeRemoteDataAccess = Nothing
Try
rda = New SqlCeRemoteDataAccess
' http://localhost/virtual_directory_alias_name/sscesa20.dll
rda.InternetUrl = "http://home-pc/SQLCE/sscesa20.dll"
rda.LocalConnectionString = _
"Provider=Microsoft.SQLSERVER." & _
"OLEDB.CE.2.0;Data Source=\My Documents\ssce.sdf"
rda.Push("Module", rdaOleDbConnectString, _
RdaBatchOption.BatchingOn)
MsgBox("Push operation completed", _
MsgBoxStyle.Information, "Push")
txtStatus.Text = "Push Data to SQLServer2000 successfully"
Catch err As SqlCeException
ShowErrors(err)
Finally
rda.Dispose()
End Try
End Function
Private Sub btnPull_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPull.Click
PullRetrieveRecordsFromSQLServer2000()
End Sub
Private Sub btnPush_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPush.Click
PushSQLServerCETableDataToSQLServer2000database()
End Sub
End Class
Please advise.