private void txtItems_TextChanged(object sender, EventArgs e)
{
try
{
MySqlCommand com = new MySqlCommand();
MySqlDataReader read;
com.CommandText = "SELECT * FROM Inventory where ProductID ='" + txtbCode.Text + "'";
com.Connection = MySQLConnection.con;
MySQLConnection.con.Open();
read = com.ExecuteReader();
while (read.Read())
{
txtCatogery.Text = read["Catogery"].ToString();
txtDiscriptions.Text = read["Description"].ToString();
txtQTY.Text = read["QTY"].ToString();
txtPrice.Text = read["Price"].ToString();
}
//Rest of code
}
}
当我在txtbCode
TextBoxes 中输入条形码时,会从 db 中获取值,但如果我有带有条形码的产品,请1234
继续输入 56 (123456) 我没有带有该条形码的产品,但文本框的值不会刷新,它们会保持读取的值约为 1234。
我该如何做到这一点?