这是在网页中直接写入的连接字符串:
string sql = @"Data Source=.\SQLExpress;AttachDBFilename=|DataDirectory|\SS.mdf; Integrated Security=True; User Instance=True";
在web.config或者app.config中的是:
<connectionStrings>
<add name="ConnStr" connectionString="Data Source=.\SQLExpress;AttachDBFilename=|DataDirectory|\SS.mdf; Integrated Security=True; User Instance=True"/>
</connectionStrings> |