private void btnAdd_Click(object sender, EventArgs e) { //get the values from form dc.type = cmbDeaCust.Text; dc.name = txtName.Text; dc.email = txtEmail.Text; dc.contact = txtContact.Text; dc.address = txtAddress.Text; dc.added_date = DateTime.Now; //getting the ID of logged in user and passing its value to Dealer or Customer module string loggedUsr = frmLogin.loggedIn; userBLL usr = udal.GetIDFromUsername(loggedUsr); dc.added_by = usr.id; //Creating a Boolean Variable to check the dealer or customer is added or not bool success = dcDal.INSERT(dc); if (success == true) { MessageBox.Show("Dealer or Customer Added Successfully."); Clear(); //Refresh Data Grid View DataTable dt = dcDal.Select(); dgvDeaCust.DataSource = dt; } else { MessageBox.Show("Failed to Add Dealer or Customer."); } error(); }