Sql 我的 mdf 数据库文件的连接字符串
Sql Connection string to my mdf database file
我的 database.mdf
与我的 application.exe
位于同一个文件夹中。我搜索了其他问题并找到了这种方式,但是在我启动程序后出现错误
string dbPath = Application.StartupPath + "\DATABASE1.MDF";
string strConnection = @"Data Source =.\SQLEXPRESS; AttachDbFilename = [" + dbPath + "]; Integrated Security = True; Connect Timeout = 30; User Instance = True";
NVM 找到解决方案。问题是 []
string dbPath = Application.StartupPath + "\DATABASE1.MDF";
string strConnection =
@"Data Source =.\SQLEXPRESS; AttachDbFilename = " + dbPath + "; Integrated Security = True; Connect Timeout = 30; User Instance = True";
我的 database.mdf
与我的 application.exe
位于同一个文件夹中。我搜索了其他问题并找到了这种方式,但是在我启动程序后出现错误
string dbPath = Application.StartupPath + "\DATABASE1.MDF";
string strConnection = @"Data Source =.\SQLEXPRESS; AttachDbFilename = [" + dbPath + "]; Integrated Security = True; Connect Timeout = 30; User Instance = True";
NVM 找到解决方案。问题是 []
string dbPath = Application.StartupPath + "\DATABASE1.MDF";
string strConnection =
@"Data Source =.\SQLEXPRESS; AttachDbFilename = " + dbPath + "; Integrated Security = True; Connect Timeout = 30; User Instance = True";