0

出于某种原因,我试图获取虚拟路径....\ 无法浏览目录。

SqlConnection sqlConnectionCmdString = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=..\..\database\ClientRegit.mdf;Integrated Security=True;User Instance=True");
4

2 回答 2

0

尝试这个:

AttachDbFilename=|DataDirectory|\database\ClientRegit.mdf
于 2013-09-02T02:55:32.197 回答
0
SqlConnection sqlConnectionCmdString = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename="+ Application.StartupPath+ @"\database\ClientRegit.mdf;Integrated Security=True;User Instance=True");
于 2013-09-02T03:17:26.830 回答