July 9, 2007 at 7:51 am
Can anyone please help me ... its urgent....
I am working with PDA application but not able to connect to .sdf file. I am using following connection string
SqlCeConnection con = new SqlCeConnection("Data Source =.\\TestDB.sdf; Password =testdb;");
but it is giving me error like: --
The database file cannot be found. Check the path to the database. [ File name = .\TestDB.sdf ]
Please tell me where I am going wrong.
Thanks in advance.
July 9, 2007 at 7:54 am
DataSource should be the name of the server and Initial Catalog will be the name of the database in the connection string. The database will have your mdf, ldf and sdf files ir so. You can't directly read the contents of the file.
Cheers,
Sugeshkumar Rajendran
SQL Server MVP
http://sugeshkr.blogspot.com
July 9, 2007 at 8:01 am
Hey Sugesh,
Nice to see your reply. Thanks a lot.
But I want to connect to mobile database...which is in .sdf file format..
Can you please explain more about it.
Regards,
Neeta
April 29, 2008 at 1:58 am
The BOL of SQL server CE gives you the method to create the connection string. The only thing happening here is you are not able to give the file to the application. It can be that the BUILD ACTION of the (SDF) file might be set to nothing. change this to content.
Second thing you will have to look into is connection string you are specifying try giving it the folder in which your application is running.
By the way which version of Visual studio are you using.
Rajesh.
MBA-IT (Software Dev. & Mgmt)
SCIT 2007-09
June 19, 2009 at 12:39 am
Replace this following
Public conn As New SqlCeConnection("Data Source = \My Documents\test.sdf")
thanxxxxxx
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply