Data Source/ server:sql server名称 (localhost / .\sqlexpress )
Initial catalog/ database:数据库名
示例如下:
1.string settings = Convert.ToString(ConfigurationManager.ConnectionStrings["SqlServices"]); SqlConnection myconn = new SqlConnection(settings); myconn.Open();2.conn.ConnectionString = "Data Source=.\\SQLExpress;Integrated Security=true; AttachDbFilename=|DataDirectory|\\Database.mdf;User Instance=true;";
Integrated Security/ uid,pwd:登陆方式(SSPI)