string connStr = string.Format("server={0};User ID={1};Password={2};database={3};Connection Reset=FALSE;Asynchronous Processing=true",".\\SQLEXPRESS", "sa","123456" ,"学生信息");
SqlConnection cn = new SqlConnection(connStr);

cn.Open();

string str = "select * from stu_1";
SqlCommand cmd = new SqlCommand(str, cn);
SqlDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
Console.WriteLine(String.Format("{0}, {1}",
reader[0], reader[1]));
}

}

public static string localhost { get; set; }

public static object 学生信息 { get; set; }

相关文章:

  • 2021-12-29
  • 2021-11-20
  • 2021-07-03
  • 2021-12-24
  • 2021-09-13
  • 2021-11-03
  • 2021-08-15
  • 2021-10-26
猜你喜欢
  • 2021-09-27
  • 2021-08-16
  • 2021-11-23
  • 2021-12-23
  • 2021-11-30
  • 2021-11-03
  • 2022-01-07
相关资源
相似解决方案