How to do Data Source to a local file?

A

amiga500

Hello,

I am making a sample program for the pocketPC using Microsoft Visual
Studio 2005. The file Local.sdf is stored in my C:\ drive and when I
compile and run the program it runs a pocketPC emulator to execute the
program. However, this is the code below:

Dim objSQLCeCommand As System.Data.SqlServerCe.SqlCeCommand = Nothing
Dim objSQLCeConnection As New
System.Data.SqlServerCe.SqlCeConnection("Data
source=\LocalDataBase.sdf")
Dim objSQLCeDataReader As
System.Data.SqlServerCe.SqlCeDataReader = Nothing
Dim strSQL As String = ""

objSQLCeConnection.Open()
strSQL = "SELECT * FROM Product"
objSQLCeCommand = New
System.Data.SqlServerCe.SqlCeCommand(strSQL, objSQLCeConnection)
objSQLCeDataReader = objSQLCeCommand.ExecuteReader
MsgBox(objSQLCeDataReader("ItemNumber"))
objSQLCeConnection.Close()

For this line:

objSQLCeConnection.Open()

I get an invalid path for SQlCeConnection...I know by heart that the
reason behind this is it cannot find the file WITHIN the PocketPC
emulator itself and when I assign the Data Source=C:\LocalDataBase.sdf,
it still tries to look for that C:\ in the PocketPC emulator. How do I
inform the program not to look for the file within the PocketPC
emulator in Visual Studio 2005 but instead to look for the file outside
the sphere of the emulator? Else, is there away I can get the file into
the PocketPC emulator instead? Any help will be greatly appreciate it.
Thanks in advance.
 
I

Ilya Tumanov [MS]

Devices can't see your local desktop hard drives. Database should be on
device and appropriate path (no drive letters or relative path) should be
used.

--
Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 

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