Connection to Database (SQL CE)

S

SiewSa

I have tried on this for so long but it just never works for me. Here are
my two questions and I am very appreciate if someone can help me on them:

1) My connection coding...

Dim myConnection As New SqlCeConnection("Data Source=\Stephan\mobiledb.sdf")

Error Code : 80004005

Message: The path is not valid, check the directory for the database [,,,
Path ,,].

But, I am pretty sure that I have put the .sdf file in that particular
directory. Am I doing something wrong on just copy the .sdf file to that
directory?

2) SqlCeDataAdapter
Dim myDataAdapter As New SqlCeDataAdapter

When I try to declare a SqlCeDataAdapter, the PC will prompt me an error as
the below:

"Reference required to assembly 'System.Data.Common' containing the base
class 'System.Data.Common.DbDataAdapter'. Add one to your project."

However, even though I have imported System.Data.Common in my class, it
never help. By the way, I am not able to locate the
System.Data.Common.DbDataAdapter namespace. My dotnet framework version is
1.1. Is that the problem of versions??? Or, there are some other reasons?
Indeed, I have already imported the 'System.Data.SqlServerCe' Namespace.

That's pretty much of them and I would like to thank in advance to someone
from you all who is helping me out. Thanks.
 
L

Lloyd Dupont

if you put it at the root of the mobile in the explorer view, then it is
\My Documents\Stephan\mobiledb.sdf

you should reference both the following dll in your project (DLL = different
namespace) System.Data.dll & System.Data.Common.dll (and maybe
System.Data.SqlClient.dll too)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top