简体   繁体   中英

connection string in with a local db c# windows forms

I've created a database using Visual Studio 2015 by adding it locally as a mdf file

following this guide: Walkthrough creating a local database SQL Server Express

The exception that gets thrown is Format of the initialization string does not conform to specification starting at index 81.

I'm building a Windows Forms application.

My connection string looks like this string cs = @"Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\\TestDb.mdf;Integrated";

You can user Visual Studio's server explorer to connect to your DB and then you'll get the correct connection string:

http://www.c-sharpcorner.com/uploadfile/suthish_nair/how-to-generate-or-find-connection-string-from-visual-studio/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM