i create c# project with Access Database but on update (0x80040E07): Data type mismatch in criteria expression, code are as under;
- private void btnUpdate_Click(object sender, EventArgs e)
- {
- double c = Convert.ToDouble(txtCNIC.Text);
- double m = Convert.ToDouble(txtMobile.Text);
- double t = Convert.ToDouble(txtResTel.Text);
-
- try
- {
- if (MetroMessageBox.Show(this, "Are you sure you want to update this record?", "MAARS Software", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
- {
- {
-
- OleDbDataAdapter da = new OleDbDataAdapter("update Booking set NameApplicant='" + txtName.Text + "', FatherName='" + txtFName.Text + "', [Occupation]='" + txtOccupation.Text + "', MonthlyIncome=" + txtMonthlyIncome.Text + ", CNICNo=" + c + ", ApplicantAge='" + txtAAge.Text + "', ApplicantAddress='" + txtAddres.Text + "', MobileNo=" + m + ", ResidenceTel=" + t + ", EmailID='" + txtEmail.Text + "', NoOfDependents='" + txtNoOfDep.Text + "', [Nominee]='" + txtNominee.Text + "', ModifiedBy='" + lblLoginID.Text + "', ModiUserType='" + lblUserType.Text + "', ModifiedDate='" + datepicker.Value.Date.ToString() + "' where FormCode=" + txtFormCode.Text + " ", conn);
- DataSet ds = new DataSet();
- da.Fill(ds);
- }
- {
-
- OleDbDataAdapter da = new OleDbDataAdapter("update [Payment] set NameApplicant='" + txtName.Text + "', FatherName='" + txtFName.Text + "', CNICNo=" + c + ", ApplicantAddress='" + txtAddres.Text + "', MobileNo=" + m + ", ResidenceTel=" + t + ", EmailID='" + txtEmail.Text + "', ModifiedBy='" + lblLoginID.Text + "', ModiUserType='" + lblUserType.Text + "', ModifiedDate='" + datepicker.Value.Date.ToString() + "' where FormCode=" + txtFormCode.Text + " ", conn);
- DataSet ds = new DataSet();
- da.Fill(ds);
-
- }
- ViewData();
- ClearAllCInfo();
- MetroMessageBox.Show(this, "User Data updated successfully", "MAARS Software", MessageBoxButtons.OK, MessageBoxIcon.Information);
- NewAppID();
- }
-
- else
- {
-
- }
- }
- catch (Exception ex)
- {
- MetroFramework.MetroMessageBox.Show(this, "Error" + ex, "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop);
- }
- }