我的application.exe
与我的string dbPath = Application.StartupPath + "\\DATABASE1.MDF";
string strConnection = @"Data Source =.\SQLEXPRESS; AttachDbFilename = [" + dbPath + "]; Integrated Security = True; Connect Timeout = 30; User Instance = True";
位于同一个文件夹中。我搜索了其他问题并找到了这种方式但是在我启动程序后出现错误
*/48 */4 ***
答案 0 :(得分:0)
NVM找到了解决方案。问题是[]
string dbPath = Application.StartupPath + "\\DATABASE1.MDF";
string strConnection =
@"Data Source =.\SQLEXPRESS; AttachDbFilename = " + dbPath + "; Integrated Security = True; Connect Timeout = 30; User Instance = True";