回复 4楼 mpi
db.foodname=treeView1.SelectedNode.Text;
textBox2.Text = db.foodname;
textBox2.ReadOnly = true;
if (treeView1.SelectedNode.Level > 1)
{
SqlConnection con = db.qq();
con.Open();
string sql="select id,foodprice from tb_food where foodname='"+db.foodname+"'";
SqlCommand com = new SqlCommand(sql, con);
SqlDataReader dr = com.ExecuteReader();
if (dr.Read())
{
textBox1.Text = dr["id"].ToString();
textBox3.Text = dr["foodprice"].ToString();
}
}
我就是这么写的就是不对