不一样的,有些小区别。SqlConnection con = new SqlConnection(@"Server =./;database= db_ExamOnline;uid = 'sa';pwd='sa'",这条代码能理解吧,这是直接连接数据库,
如果是连接mdf文件,SqlConnection con = new SqlConnection(@"Server =./;AttachDBFilename=|DataDirectory|\db_ExamOnline.mdf;;uid = 'sa';pwd='sa'",,
仔细看,有点小区别的,但是原理是一样的 |