Data Type mismatch in criteria expression when Table Adapter Update

扶醉桌前 提交于 2019-12-11 14:17:51

问题


I have already been searched solution and can't get the right solution yet.

ObjDRow = DataDataSet.Client.Rows.Find(strClientNo)

With ObjDRow
      .ClientName = txtClientName.Text.Trim
      .ClientAddr = txtAddr.Text.Trim
      If txtRegOffice.Text = "" Then
         .ClientRegOfficeAddr = txtAddr.Text.Trim
      Else
         .ClientRegOfficeAddr = txtRegOffice.Text.Trim
      End If
         .MailtoCorresAddr = RBtnCorresAddr.Checked
         .MailtoRegOffice = RBtnRegOffice.Checked
         .ClientHPhone = mskHandPhone.Text.Trim
         .ClientPager = mskPagerNo.Text.Trim
         .ClientTel = mskTelephone.Text.Trim
         .ClientFaxNo = mskFax.Text.Trim
         .ClientEmail = txtEmail.Text.Trim
         .PrimaryPartner = txtPriPartner.Text.Trim
         .SecondPartner = txtSecPartner.Text.Trim
         .BroughtInBy = cboPreferredBy.Text.Trim
         .PersonIncharge = cboPersonIncharge.Text.Trim
         .GLAC = cboGLAcode.Text.Trim
         .ContactPerson = txtContactPerson.Text.Trim
         .AcraNo = txtAcraNo.Text.Trim
         .Active = chkActive.Checked

          If dtpfyear.Checked = True Then
             .YearEnd = dtpfyear.Text
          End If
          .DeptNo = cboDeptNo.Text.Trim
          .DateJoined = dtDateJoined.Value
          If cboClientName.SelectedIndex = -1 Then
              .Group = txtClientNo.Text
          Else
              .Group = cboClientName.SelectedValue
          End If
         .GroupStatus = RButtonMainYes.Checked
         .MainGroup = RButtonSubYes.Checked
         If IsDate(dtIncorporationDate.Text) Then
              .DateOfIncorporation = dtIncorporationDate.Text
         Else
              .SetDateOfIncorporationNull()
         End If
     End With
   ObjDRow.EndEdit()
 ClientTableAdapter.Update(DataDataSet.Client)

Error is occurs when ClientTableAdapter Update.

This error occurs for some client only.

I already check datatype of database and table adapter's datatype and all datatype are same.

My input value datatype and table adapter's datatype are same.

This error occurs even I command all line of update code (.ClientName to last line) but this error still occurs.WTF

Most answers say this is a single quote problem but In my case, There is no single quote.

All data types are same and input values are the same with datatype.

** Updated**

This error still occurs even I do like=>

ObjDRow = DataDataSet.Client.Rows.Find(strClientNo)
                ObjDRow.EndEdit()
                ClientTableAdapter.Update(DataDataSet.Client)

There is nothing change just select and update.

But if I remove ObjDRow.EndEdit().All are fine. There is no error.

来源:https://stackoverflow.com/questions/51605576/data-type-mismatch-in-criteria-expression-when-table-adapter-update

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!