HOW TO LOAD *.SDF DURING THE TEST DATABASE APPLICATION IN WM 5.0

G

Guest

Hello Friend

I have a problem with sql query analyser in WM 5.0

I have created a sample database using C# for Pocket Pc 2005

In the window mobile emulator , I have created the database file using the
sql query analyser. I was able to create the table and insert the values into
the table . Then I Imported the database file from the emulator to the
desktop and then I copied the sdf file to the \\bin\\debug directory current
in the project folder.

When I tired to run the program , I a getting an error which is given below

The database file cannot be opened. Check the the path of the database file.
File Name = \program\SampleDatabase\ABC.sdf not found.

I copied the database file i.e. "ABC.sdf" to the \\bin\\debug\ABC.sdf is it
necessary step to do ?

for example if I create the database file ABC.sdf in the emulator and the
sdf file resides in the emulator, then

using the following following c# code , will it load the sdf file directly
from the path which is given below \program file\SampleDatabase\ABC.sdf

string _connString =
String.Format(System.Globalization.CultureInfo.InvariantCulture,
@"Data Source = {0}\ABC.sdf",
Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase));

Can any one tell me correct procedure to create a sdf file in the emulator
using SQL Query Analyser and testing the application in the emulator. I am
facing problem how to load sdf file in the window mobile emulator, when
testing the application in WM5.0 Emulator.


Kindly help me if any one has any information regaring this issue.


- PHIJO MATHEW PHILIP.
 
P

Peter Foot [MVP]

Adding it to the \bin\debug folder wont get it deployed with your app. Add
it to your project - Add Existing Item and with the file selected in the
Solution Explorer pane in Visual Studio check the property pane - make sure
Build Action is set to Content and it is configured to copy to target path
(Always or When Newer).

Peter
 

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