private void chaxu()
{
string myConStr = "Data Source=.;Initial Catalog=wo;Integrated Security=True";
SqlConnection myCon = new SqlConnection(myConStr);
myCon.Open();
SqlCommand myCom = new SqlCommand();
myCom.CommandType = CommandType.Text;
string comStr = "select 成员编号,地址编号,姓氏,名字,角色,发送贺卡 from 家庭成员";
comStr = comStr + " where 成员编号='" + textBox1.Text.ToString() + "'";
myCom.CommandText = comStr;
myCom.Connection = myCon;
SqlDataReader myRead = myCom.ExecuteReader();
myRead.Read();
this.textBox1.Text = myRead.GetInt32(0).ToString();
this.textBox2.Text = myRead.GetInt32(1).ToString();
this.textBox3.Text = myRead.GetString(2);
this.textBox4.Text = myRead.GetString(3);
this.textBox5.Text = myRead.GetString(4);
this.textBox6.Text = myRead.GetBoolean(5).ToString();
myRead.Close();
myCon.Close();
}
这个是查询函数
我是学生QQ2362910894 真心求个解决方法 |