Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

SqlCE connection issue

Avatar of MartinHouse
MartinHouseFlag for United Kingdom of Great Britain and Northern Ireland asked on
Smartphone Programming
6 Comments1 Solution697 ViewsLast Modified:

I have a simple application that opens an SQL database.  I'm usinf vb.net with CF2.0 on VS2005.  The target device is running WincE 5.0 .

When I run the application from Visual Studio 2005 it performs correctly ( running on the device ).  However, when I disconnect the device from Actievsync and run the appliucation in situ it fails at the connection.open command.

The database is located ( I intend, and beleive ) on the device.

Here are the relevant bits of code

    Public Const SQL_DATABASE As String = "\My Documents\dbtest.sdf"

    Public connDB As New SqlServerCe.SqlCeConnection
    Public cmdDB As New SqlServerCe.SqlCeCommand

        connDB.ConnectionString = "Data Source =" & SQL_DATABASE


        Catch e As Exception

            MsgBox("Error opening SQL database [" & e.Message & "]", MsgBoxStyle.Critical, "DBTest")

        End Try

            cmdDB.Connection = connDB

        Catch e As Exception
            MsgBox("Error setting connection for SQL database [" & e.Message & "]", MsgBoxStyle.Critical, "DBTest")
        End Try

Before the connection open I have checked if the file exists.

I am puzzled why this is happening at all, but also by the messages shown by the exception - there is no exception text ( I have also tried with SqlCeException )

Can anyone suggest where I may be going wrong ?


Avatar of jkanisut

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answers