コード例 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            //getting values from the input fields

            v.Brand = TextBoxBrand.Text;
            v.Model = textBoxModel.Text;
            v.EngineNo = textBoxEngNo.Text;
            v.ChassiNo = textBoxChassiNo.Text;
            v.ProductionYear = Int32.Parse(textBoxProdYear.Text);
            v.Type = comboBoxType.Text;
            v.CustomerID = customerID;

            //check whether insertion is success

            bool success = v.insert(v);

            if (success == true)
            {
                MessageBox.Show("Successfully Inserted!");

                //to clear data on fields

                clear();
            }
            else
            {
                MessageBox.Show("Error Occured!");
            }
        }