My database.mdf
is in the same folder where my application.exe
is. 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 . 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";
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.