c#如何实现固定信息,自动判断录入
如何实现输入编号,如果有此编号的记录,就将此记录的其它字段赋值给相应的textbox中我写了,但好像不对,不知道怎么改,希望高手帮忙
if (e.KeyCode == Keys.Enter)
{
myclass.opendata();
DataSet ds = new DataSet();
SqlDataAdapter adp = new SqlDataAdapter();
string sql = "select * from materialinfo where bh='" + bh.Text.Trim() + "'";
adp. = sql;
adp.Fill(ds);
this.wzlb.Text = ds.Tables[0].Rows[0][1].ToString().Trim();
this.clmc.Text = ds.Tables[0].Rows[0][2].ToString().Trim();
this.xhgg.Text = ds.Tables[0].Rows[0][3].ToString().Trim();
this.jldw.Text = ds.Tables[0].Rows[0][4].ToString().Trim();
}