sqlce: change database directory

R

Romain TAILLANDIER

hi group

i have a probleme, it seems a stupid and easy-to-solve problem
but i can't solve it anyway :p

i have a database named MyDB.sdf, and it is at root :
\MyDB.sdf

it is not good for me to have it at root, so i want to move it in :
\Program Files\myApp\MyDB.sdf

i was using a connection string which is exactly that and perfectly working
:
"Data Source = MyDB.sdf;"

to move my DB in the rep i want, i try this:
"Data Source = Program Files\MyApp\MyDB.sdf;"

but it doesn't work. i try a few others like this one but it never work...
wich is the correct conenction string please ?

thanks for help,
ROM
 
R

Romain TAILLANDIER

thank you both, but the problem still remind :)

i had allready try those solutions, but thank you for playing, try again :)
lol

sorry for this bad humour, but i think my brain is bugging too

ROM
 
K

Kenan

if "\Program Files\MyApp\MyDB.sdf" is a valid path then
it shoul work.

Dim strConn As String
strConn = "data source=\Program Files\MyApp\MyDB.sdf"
Dim connCE As SqlCeConnection
connCE = New SqlCeConnection(strConn)
ConnCE.Open
 
B

Bart

u might want to try:
"Data Source=\\Program Files\\MyApp\\MyDB.sdf"
or
use the @ character before the datasource
 

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