Results 1 to 2 of 2

Thread: SqlCe Exception "The operation completed successfully"

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2013
    Location
    Carmarthen
    Posts
    6

    SqlCe Exception "The operation completed successfully"

    Hello People I'm having a major Issue. I have created a windows application to display data from a database(sdf file) in a data grid view. The issue is the data table is on a mobile device running on windows CE. Now my desktop and mobile device are connected via activeSync.

    I have to two connection strings. One for testing on my local computer and one for connecting to the database on the mobile device

    1.casioconnection = "Data Source=Mobile Device\Program Files\VetSystemCE\vet.sdf"
    2.developerConnection = "Data Source=C:\Users\Public\Documents\vet.sdf"

    here is the code to connect to the data table and display the data in the datagridview.

    Dim con As SqlCeConnection
    Dim sqlDelete As String
    Dim da As SqlCeDataAdapter
    Dim DsLocalAnimalTest1 As New DataSet
    Dim BindingSourceLocal1 As New BindingSource


    Private Sub refreshAnimalTestCasio()
    'Define sqlCeConnection
    Try
    Me.con = New SqlCeConnection()
    Me.con.ConnectionString = My.Settings.developerConnection
    'Open SqlCeConnection
    Me.con.Open()
    Catch ex As SqlCeException
    MessageBox.Show("sqlCe Error:" & ex.Message)
    End Try

    'Sql Select statment for sqlCeDataAdapter
    Me.sqlString = "SELECT * FROM Table_animalsMobile"

    'Define SqlCeDataAdapter
    Me.da = New SqlCeDataAdapter(sqlString, con)
    Me.DsLocalAnimalTest1.Clear()
    Me.da.Fill(Me.DsLocalAnimalTest1, "Table_animalsMobile")
    Me.con.Close()

    'Define Binding Sources Data Source
    'Define which Data table the binding source is connected to
    Me.BindingSourceLocal1.DataSource = Me.DsLocalAnimalTest1
    Me.BindingSourceLocal1.DataMember = "Table_animalsMobile"

    'Define DataGrid
    Me.DataGridView5.DataSource = Me.BindingSourceLocal1
    End Sub

    When I use the "developerConnection" the code works fine but when I use the "casioConnection" to connect to the Casio device the application crashes. It seems to have a problem filling the sqlCeDataAdatper and I get this error SqlCeException: The operation completed successfully. Can anyone help me get around this error

  2. #2
    Fanatic Member
    Join Date
    Oct 2011
    Location
    Sydney, Australia
    Posts
    756

    Re: SqlCe Exception "The operation completed successfully"

    Hi,
    DataSource needs to be a path to the location the database is stored, Data Source=Mobile Device\ is not a path, C:\ is
    My CodeBank Submissions
    • Listbox with transparency and picture support - Click Here
    • Check for a true internet connection - Click Here
    • Open Cash drawer connected to receipt printer - Click Here
    • Custom color and size border around form - Click Here
    • Upload file to website without user logins, includes PHP - Click Here
    • List All Removable USB Storage Devices - Click Here
    • Custom On/Off Slide Control - Click Here
    • Insert multiple rows of data into one database table using parameters - Click Here
    • Trigger USB/Serial Cash Drawer - Click Here

Tags for this Thread

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