Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- `private void button1_Click(object sender, EventArgs e)
- {
- //int isP = 0;
- string a = comboBox1.Text;
- string ConString = " datasource = localhost; port = 3306; username = root; password = 3306";
- {
- {
- string sql = "SELECT count (*) FROM [initialentry] WHERE aircraft_number = @a";
- using (MySqlConnection cn = new MySqlConnection(ConString))
- {
- cn.Open();
- using (MySqlCommand cmd = new MySqlCommand(sql, cn))
- {
- cmd.Parameters.AddWithValue("@aircraft_number", a);
- MySqlDataReader reader = cmd.ExecuteReader();
- if (reader.HasRows)
- {
- label1.Text = "Record exists";
- }
- else
- {
- label1.Text = "Record does not exist";
- }
- }
- }
- }
- }
- }`
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement