如何点击一个form中的Button从数据库中读出数据给另一个form的textbox
SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;User Instance=True;AttachDBFilename=D:\My Documents\Visual Studio 2008\Projects\FirstFace\FirstFace\bin\Debug\MyDB.mdf;Integrated Security=True");con.Open();
// Form4 form41 = new Form4();
string string1 = "select * from student";
SqlCommand cmd = new SqlCommand(string1, con);
SqlDataReader rd = cmd.ExecuteReader();
while (rd.Read())
{
form41.textBox1.Text = rd["id"].ToString().Trim();
form41.textBox2.Text = rd["name"].ToString().Trim();
form41.textBox4.Text = rd["age"].ToString().Trim();
// textBox10.Text = rd["age"].ToString().Trim();
}
rd.Close();
con.Close();
// form41.Show();
说 form41.textBox1.Text 不可访问?什么意思啊?那位大哥教教我!刚学C#