Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Sql server Ce connection. Expand / Collapse
Author
Message
Posted Monday, July 9, 2007 7:51 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, August 3, 2011 11:32 PM
Points: 156, Visits: 63

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.

Post #379986
Posted Monday, July 9, 2007 7:54 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Monday, November 17, 2014 7:05 AM
Points: 3,461, Visits: 353
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
Post #379988
Posted Monday, July 9, 2007 8:01 AM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, August 3, 2011 11:32 PM
Points: 156, Visits: 63

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

Post #379997
Posted Tuesday, April 29, 2008 1:58 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Wednesday, July 23, 2008 8:31 AM
Points: 15, Visits: 21
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
Post #491883
Posted Friday, June 19, 2009 12:39 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, September 26, 2011 7:29 AM
Points: 8, Visits: 8
Replace this following


Public conn As New SqlCeConnection("Data Source = \My Documents\test.sdf")




thanxxxxxx
Post #738079
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse