Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void textBox22_TextChanged(object sender, EventArgs e)
- {
- String path = "Data Source=LOCALHOST; Initial Catalog= sadd; username=root; password=''";
- MySqlConnection sqlconn = new MySqlConnection(path); //communicator //constructors
- MySqlCommand sqlcomm = new MySqlCommand();
- MySqlDataReader sqldr;
- sqlconn.Open();
- sqlcomm.Connection = sqlconn;
- sqlcomm.CommandType = CommandType.Text;
- sqlcomm.CommandText = "Select * from approvedrecords where VoucherNumber=" + textBox22.Text + "";
- sqldr = sqlcomm.ExecuteReader();
- sqldr.Read();
- if (sqldr.HasRows)
- {
- textBox26.Text = sqldr[0].ToString();
- }
- sqlconn.Close();
- if (textBox22.Text == textBox26.Text)
- {
- String path8 = "Data Source=LOCALHOST; Initial Catalog= sadd; username=root; password=''";
- MySqlConnection sqlcon = new MySqlConnection(path8); //communicator //constructors
- string query = "select * from approvedrecords where VoucherNumber = " + textBox22.Text + " ";
- MySqlCommand cmd = new MySqlCommand(query, sqlcon);
- MySqlDataReader dbr;
- sqlcon.Open();
- dbr = cmd.ExecuteReader();
- while (dbr.Read())
- {
- string a = (string)dbr["CheckNumber"].ToString();
- string b = (string)dbr["DateCreated"];
- string c = (string)dbr["Status"];
- string d = (string)dbr["PayeesName"];
- string f = (string)dbr["Amount"].ToString();
- string g = (string)dbr["DatePrinted"];
- string h = (string)dbr["Particulars"];
- string i = (string)dbr["Prepared_by"];
- string j = (string)dbr["Payment_received_by"];
- textBox21.Text = a;
- textBox23.Text = b;
- textBox28.Text = c;
- textBox20.Text = d;
- textBox19.Text = f;
- textBox27.Text = g;
- textBox18.Text = h;
- textBox16.Text = i;
- textBox17.Text = j;
- }
- }
- else
- {
- MessageBox.Show("ID doesn't exist!");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement