Rizwan Ahmed

Rizwan Ahmed

  • NA
  • 80
  • 12.3k

update Error 0x80040E07 Access Database in c#

Dec 7 2018 12:45 PM
i create c# project with Access Database but on update (0x80040E07): Data type mismatch in criteria expression, code are as under;
 
  1. private void btnUpdate_Click(object sender, EventArgs e)  
  2.         {  
  3.             double c = Convert.ToDouble(txtCNIC.Text);  
  4.             double m = Convert.ToDouble(txtMobile.Text);  
  5.             double t = Convert.ToDouble(txtResTel.Text);  
  6.   
  7.             try  
  8.             {  
  9.                 if (MetroMessageBox.Show(this"Are you sure you want to update this record?""MAARS Software", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)  
  10.                 {  
  11.                     {  
  12.                         // Update Data in Booking Table  
  13.                         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);  
  14.                         DataSet ds = new DataSet();  
  15.                         da.Fill(ds);  
  16.                     }  
  17.                     {  
  18.                         // Update Data in Payment Table  
  19.                         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);  
  20.                         DataSet ds = new DataSet();  
  21.                         da.Fill(ds);  
  22.                           
  23.                     }  
  24.                     ViewData();  
  25.                     ClearAllCInfo();  
  26.                     MetroMessageBox.Show(this"User Data updated successfully""MAARS Software", MessageBoxButtons.OK, MessageBoxIcon.Information);  
  27.                     NewAppID();  
  28.                 }  
  29.   
  30.                 else  
  31.                 {  
  32.   
  33.                 }  
  34.             }  
  35.             catch (Exception ex)  
  36.             {  
  37.                 MetroFramework.MetroMessageBox.Show(this"Error" + ex, "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop);  
  38.             }  
  39.         }  
 

Answers (2)