Results 1 to 23 of 23

Thread: [Resolved] - Remote Data Access - Error 80004005

Threaded View

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2005
    Posts
    79

    Resolved [Resolved] - Remote Data Access - Error 80004005

    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)

    VB Code:
    1. Imports System.Data.SqlServerCe
    2. Imports System.Text
    3. Imports System.IO
    4.  
    5.  
    6.  
    7. Public Class Form1
    8.     Inherits System.Windows.Forms.Form
    9.     Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
    10.     Dim conn As New SqlCeConnection("Data Source=\My Documents\ssce.sdf")
    11.     Dim sqlCreateTable As SqlCeCommand = conn.CreateCommand()
    12.  
    13.     ' Connection string to SQL Server 2000
    14.     Dim rdaOleDbConnectString As String = _
    15.             "Provider=sqloledb; Data Source=home-pc;Initial" & _
    16.             " Catalog=Attendance;User Id=sa;Password="
    17.  
    18.     ' Initialize the RDA object.
    19.     Dim rda As SqlCeRemoteDataAccess = Nothing
    20.  
    21.  
    22. #Region " Windows Form Designer generated code "
    23.  
    24.     Public Sub New()
    25.         MyBase.New()
    26.  
    27.         'This call is required by the Windows Form Designer.
    28.         InitializeComponent()
    29.  
    30.         'Add any initialization after the InitializeComponent() call
    31.  
    32.     End Sub
    33.  
    34.     'Form overrides dispose to clean up the component list.
    35.     Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    36.         MyBase.Dispose(disposing)
    37.     End Sub
    38.  
    39.     'NOTE: The following procedure is required by the Windows Form Designer
    40.     'It can be modified using the Windows Form Designer.  
    41.     'Do not modify it using the code editor.
    42.     Friend WithEvents btnPush As System.Windows.Forms.Button
    43.     Friend WithEvents btnPull As System.Windows.Forms.Button
    44.     Friend WithEvents Label1 As System.Windows.Forms.Label
    45.     Friend WithEvents txtStatus As System.Windows.Forms.TextBox
    46.     Private Sub InitializeComponent()
    47.         Me.MainMenu1 = New System.Windows.Forms.MainMenu
    48.         Me.btnPush = New System.Windows.Forms.Button
    49.         Me.btnPull = New System.Windows.Forms.Button
    50.         Me.txtStatus = New System.Windows.Forms.TextBox
    51.         Me.Label1 = New System.Windows.Forms.Label
    52.         '
    53.         'btnPush
    54.         '
    55.         Me.btnPush.Location = New System.Drawing.Point(16, 80)
    56.         Me.btnPush.Text = "Push"
    57.         '
    58.         'btnPull
    59.         '
    60.         Me.btnPull.Location = New System.Drawing.Point(16, 56)
    61.         Me.btnPull.Text = "Pull"
    62.         '
    63.         'txtStatus
    64.         '
    65.         Me.txtStatus.Location = New System.Drawing.Point(56, 136)
    66.         Me.txtStatus.Size = New System.Drawing.Size(168, 20)
    67.         Me.txtStatus.Text = ""
    68.         '
    69.         'Label1
    70.         '
    71.         Me.Label1.Location = New System.Drawing.Point(8, 136)
    72.         Me.Label1.Size = New System.Drawing.Size(40, 16)
    73.         Me.Label1.Text = "Status"
    74.         '
    75.         'Form1
    76.         '
    77.         Me.Controls.Add(Me.Label1)
    78.         Me.Controls.Add(Me.txtStatus)
    79.         Me.Controls.Add(Me.btnPull)
    80.         Me.Controls.Add(Me.btnPush)
    81.         Me.Menu = Me.MainMenu1
    82.         Me.Text = "RDA Example"
    83.  
    84.     End Sub
    85.  
    86. #End Region
    87.  
    88.     Public Sub createDB()
    89.         ' if database exists, delete it and create a new one
    90.         If File.Exists( _
    91.           "\My Documents\ssce.sdf") Then
    92.             File.Delete("\My Documents\ssce.sdf")
    93.         End If
    94.         ' Create a new database
    95.         Dim sqlEngine As New SqlCeEngine( _
    96.           "Data Source=" & _
    97.           "\My Documents\ssce.sdf")
    98.         sqlEngine.CreateDatabase()
    99.         txtStatus.Text = "DB Created successfully"
    100.     End Sub
    101.  
    102.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    103.         createDB()
    104.  
    105.  
    106.     End Sub
    107.  
    108.     Private Function PullRetrieveRecordsFromSQLServer2000()
    109.         Try
    110.             rda = New SqlCeRemoteDataAccess
    111.             '   [url]http://localhost/virtual_directory_alias_name/sscesa20.dll[/url]
    112.             rda.InternetUrl = "http://home-pc/SQLCE/sscesa20.dll"
    113.             rda.LocalConnectionString = _
    114.                  "Provider=Microsoft.SQLSERVER." & _
    115.                        "OLEDB.CE.2.0;Data Source=\My Documents\ssce.sdf"
    116.             rda.Pull("Module", "Select * from Module", _
    117.                      rdaOleDbConnectString, _
    118.                      RdaTrackOption.TrackingOnWithIndexes, _
    119.                      "ErrorTable")
    120.             MsgBox("Pull operation completed", _
    121.                 MsgBoxStyle.Information, _
    122.              "Pull")
    123.             txtStatus.Text = "Pull Data to SQLServerCE successfully"
    124.         Catch err As SqlCeException
    125.             ShowErrors(err)
    126.         Finally
    127.             rda.Dispose()
    128.         End Try
    129.  
    130.     End Function
    131.     Public Shared Sub ShowErrors(ByVal e As SqlCeException)
    132.         Dim errorCollection As SqlCeErrorCollection = e.Errors
    133.  
    134.         Dim bld As New StringBuilder
    135.         Dim inner As Exception = e.InnerException
    136.  
    137.         If Not inner Is Nothing Then
    138.             MessageBox.Show(("Inner Exception: " & inner.ToString()))
    139.         End If
    140.         Dim err As SqlCeError
    141.         ' Enumerate each error to a message box.
    142.         For Each err In errorCollection
    143.             bld.Append((ControlChars.Cr & _
    144.                         " Error Code: " & _
    145.                         err.HResult.ToString("X")))
    146.             bld.Append((ControlChars.Cr & _
    147.                         " Message   : " & _
    148.                         err.Message))
    149.             bld.Append((ControlChars.Cr & _
    150.                         " Minor Err.: " & _
    151.                         err.NativeError))
    152.             bld.Append((ControlChars.Cr & _
    153.                         " Source    : " & _
    154.                         err.Source))
    155.             ' Retrieve the error parameter
    156.             ' numbers for each error.
    157.             Dim numPar As Integer
    158.             For Each numPar In err.NumericErrorParameters
    159.                 If 0 <> numPar Then
    160.                     bld.Append((ControlChars.Cr & _
    161.                                 " Num. Par. : " & _
    162.                                 numPar))
    163.                 End If
    164.             Next numPar
    165.             ' Retrieve the error parameters for each error.
    166.             Dim errPar As String
    167.             For Each errPar In err.ErrorParameters
    168.                 If [String].Empty <> errPar Then
    169.                     bld.Append((ControlChars.Cr & _
    170.                                 " Err. Par. : " & _
    171.                                 errPar))
    172.                 End If
    173.             Next errPar
    174.             MessageBox.Show(bld.ToString())
    175.             bld.Remove(0, bld.Length)
    176.         Next err
    177.     End Sub
    178.     Private Function PushSQLServerCETableDataToSQLServer2000database()
    179.  
    180.         ' Initialize the RDA object.
    181.         Dim rda As SqlCeRemoteDataAccess = Nothing
    182.  
    183.         Try
    184.             rda = New SqlCeRemoteDataAccess
    185.             '   [url]http://localhost/virtual_directory_alias_name/sscesa20.dll[/url]
    186.             rda.InternetUrl = "http://home-pc/SQLCE/sscesa20.dll"
    187.             rda.LocalConnectionString = _
    188.                        "Provider=Microsoft.SQLSERVER." & _
    189.                        "OLEDB.CE.2.0;Data Source=\My Documents\ssce.sdf"
    190.             rda.Push("Module", rdaOleDbConnectString, _
    191.                      RdaBatchOption.BatchingOn)
    192.             MsgBox("Push operation completed", _
    193.                    MsgBoxStyle.Information, "Push")
    194.             txtStatus.Text = "Push Data to SQLServer2000 successfully"
    195.         Catch err As SqlCeException
    196.             ShowErrors(err)
    197.         Finally
    198.             rda.Dispose()
    199.         End Try
    200.  
    201.     End Function
    202.  
    203.  
    204.  
    205.     Private Sub btnPull_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPull.Click
    206.         PullRetrieveRecordsFromSQLServer2000()
    207.  
    208.     End Sub
    209.  
    210.     Private Sub btnPush_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPush.Click
    211.         PushSQLServerCETableDataToSQLServer2000database()
    212.  
    213.     End Sub
    214.  
    215.  
    216. End Class

    Please advise.
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by karahim; Oct 12th, 2005 at 11:36 PM. Reason: resolved

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width