Click here to Skip to main content
15,911,360 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i created local database with vs2010 and attached it with new project vs2010 as ( Microsoft SQL Server Compact 3.5)

now i get error with connection string

C#
"Data Source=|DataDirectory|/Database.sdf"


A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)


any idea
Posted

Hi,

Try this below link

https://www.connectionstrings.com/sql-server-compact/[^]

I hope you will get idea about mobile connection string as well as solution for above error.

Thank you.
 
Share this answer
 
Comments
Golden Basim 5-Apr-15 0:33am    
"Data Source="+ System.IO.Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location),"jepsalesdb.sdf");
[no name] 30-Aug-15 2:36am    
ok fine
You need to mentioned the username a d password as well in the connection string
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900