一般的远程访问的写成这样:
Data Source=IP;Initial Catalog=数据库名;UserID=用户名;Password=密码
本地访问的写成这样:
Data Source=(local);Initial Catalog=数据库名;UserID=用户名;Password=密码
如果是本地的,通过windows组件验证的(也就是没有用户名,密码的)写成这样:
Data Source=(local);Initial Catalog=数据库名;Integrated Security=True
如果不是默认的实例,假如实例名是SQLEXPRESS,写成这样:
Data Source=(local)/SQLEXPRESS;Initial Catalog=数据库名;Integrated Security=True