日期:2014-05-17 浏览次数:20970 次
private void button2_Click(object sender, EventArgs e)
{ string s = textBox2.Text;
SqlConnection cn = new SqlConnection("Data Source=.\\SQLEXPRESS;DataBase=MyDatas;Integrated Security=True;");
cn.Open();
string str=("select Name from Stu where Id=s");
SqlCommand cmd=new SqlCommand(str,cn);
SqlDataReader Dr = cmd.ExecuteReader();
while (Dr.Read())
{
string name = Dr.GetString(0);
textBox3.Text = name;
}
}