sqlce: change database directory

  • Thread starter Thread starter Romain TAILLANDIER
  • Start date Start date
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
 
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
 
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
 
u might want to try:
"Data Source=\\Program Files\\MyApp\\MyDB.sdf"
or
use the @ character before the datasource
 
Back
Top