[英]Sql Connection string to my mdf database file
My database.mdf
is in the same folder where my application.exe
is. 我的
database.mdf
与我的application.exe
位于同一文件夹中。 I searched other questions and found this way but after I start my program I get an error 我搜索了其他问题并找到了这种方式,但是启动程序后出现错误
string dbPath = Application.StartupPath + "\\DATABASE1.MDF";
string strConnection = @"Data Source =.\SQLEXPRESS; AttachDbFilename = [" + dbPath + "]; Integrated Security = True; Connect Timeout = 30; User Instance = True";
NVM found soluation . NVM找到了解决方法。 the problem was []
问题是[]
string dbPath = Application.StartupPath + "\\DATABASE1.MDF";
string strConnection =
@"Data Source =.\SQLEXPRESS; AttachDbFilename = " + dbPath + "; Integrated Security = True; Connect Timeout = 30; User Instance = True";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.