110,025
社区成员




//获取数据库数据并填充一个DataTable
SqlConnection conn = new SqlConnection("连接数据库字符串");
SqlDataAdapter da = new SqlDataAdapter("SQL查询语句",conn);
conn.Open();
DataTable dt = new DataTable();
da.Fill(dt);
da.Dispose();
conn.Close();
conn.Dispose();
//把DataTable中的相关数据显示到界面中
this.textBox1.Text = dt.Rows["行"]["列"].ToString();
this.textBox2.Text = dt.Rows["行"]["列"].ToString();
this.textBox3.Text = dt.Rows["行"]["列"].ToString();
..........................