SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Sql server Ce connection.


Sql server Ce connection.

Author
Message
Neeta Patil
Neeta Patil
SSC-Enthusiastic
SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)

Group: General Forum Members
Points: 172 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.


Sugesh Kumar
Sugesh Kumar
SSCarpal Tunnel
SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)SSCarpal Tunnel (4.6K reputation)

Group: General Forum Members
Points: 4567 Visits: 358
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
Neeta Patil
Neeta Patil
SSC-Enthusiastic
SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)SSC-Enthusiastic (172 reputation)

Group: General Forum Members
Points: 172 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


Rajesh Patil
Rajesh Patil
SSC Rookie
SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)SSC Rookie (29 reputation)

Group: General Forum Members
Points: 29 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
pravingpatil2081
pravingpatil2081
Grasshopper
Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)Grasshopper (12 reputation)

Group: General Forum Members
Points: 12 Visits: 8
Replace this following


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




thanxxxxxx
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search