出于某种原因,我试图获取虚拟路径....\ 无法浏览目录。
SqlConnection sqlConnectionCmdString = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=..\..\database\ClientRegit.mdf;Integrated Security=True;User Instance=True");
出于某种原因,我试图获取虚拟路径....\ 无法浏览目录。
SqlConnection sqlConnectionCmdString = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=..\..\database\ClientRegit.mdf;Integrated Security=True;User Instance=True");
尝试这个:
AttachDbFilename=|DataDirectory|\database\ClientRegit.mdf
SqlConnection sqlConnectionCmdString = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename="+ Application.StartupPath+ @"\database\ClientRegit.mdf;Integrated Security=True;User Instance=True");