if (e.KeyChar == (char)13) { _connection.Open(); SqlCeCommand desc_command = new SqlCeCommand("select description from Items where barcode=@barcode;", _connection); desc_command.Parameters.AddWithValue("@barcode", txt_barcode.Text); SqlCeDataReader rdr = desc_command.ExecuteReader(); if (rdr.Read()) { txt_description.Text = rdr.GetString(0); SqlCeCommand _addcommand = new SqlCeCommand("insert into Inventory values(@barcode,@amount);", _connection); _addcommand.Parameters.AddWithValue("@barcode", txt_barcode.Text); _addcommand.Parameters.AddWithValue("@amount", txt_amount.Text); _addcommand.ExecuteNonQuery(); _connection.Close(); txt_barcode.SelectAll(); } else { PlaySound(@"\Windows\Voicbeep", IntPtr.Zero, (int)(PlaySoundFlags.SND_FILENAME | PlaySoundFlags.SND_SYNC)); txt_description.Text = "--------------"; txt_barcode.SelectAll(); txt_barcode.Focus(); _connection.Close(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)