你换种方式试一下:用连接串来连接sql数据库
SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=data;User ID=sa;password=sa;Integrated Security=False");