Пример #1
0
        private void btnsearch_Click(object sender, EventArgs e)
        {
            try
            {
                ClsSqlServer searchcommand = new ClsSqlServer();
                DataSet      dset          = searchcommand.getCustomers(txtapartiment.Text);
                int          room          = Convert.ToInt32(txtapartiment.Text);

                if (string.IsNullOrEmpty(txtapartiment.Text))
                {
                    MessageBox.Show("Sorry, Make sure you fill the Apartment field", "Error");
                }
                //if (room < 200 || room > 250)
                //{
                //    MessageBox.Show("Make sure you choose the room between 200 and 250.", "Error");
                //    txtapartiment.Focus();
                //}

                else
                {
                    txtfname.Text   = dset.Tables[0].Rows[0][1].ToString();
                    txtlname.Text   = dset.Tables[0].Rows[0][2].ToString();
                    cmbgender.Text  = dset.Tables[0].Rows[0][3].ToString();
                    txtphone.Text   = dset.Tables[0].Rows[0][4].ToString();
                    cmbpayment.Text = dset.Tables[0].Rows[0][5].ToString();
                    dTPicker1.Text  = dset.Tables[0].Rows[0][6].ToString();
                }
            }
            catch (Exception m)
            {
                MessageBox.Show("Sorry, Record doesn't exist.", "Error");
            }
        }