I want to search mobile no from Grid with selection of ComboBox. Search bar search names but when i code for mobile and cnic this error appeared, error and code as under; (using C# with Access2016 database)
System.Data.EvaluateException: 'Cannot perform 'Like' operation on System.Double and System.String.'

System.Data.EvaluateException: 'Cannot perform 'Like' operation on System.Double and System.String.'

- private void txtSearchBar_TextChanged(object sender, EventArgs e)
- {
- if (comboxSearch.Text == "Mobile No")
- {
- DataView dv = dt.DefaultView;
- dv.RowFilter = "MobileNo LIKE '%" + txtSrchBar.Text.ToString() + "%' ";
- }
- }
Amit GuptaRank #190 · 12.8K reputationPosted Nov 20, 2018, 6:45 PM EST
Laxmidhar SahooRank #383 · 6.6K reputationPosted Nov 20, 2018, 4:38 PM EST
Sanwar RanwaRank #23 · 44.7K reputationPosted Nov 20, 2018, 6:03 PM EST
Rizwan Ahmed79 reputationPosted Nov 20, 2018, 8:48 PM EST
Laxmidhar Sahoo it's in Double.
Amit Gupta i tried it but now this error comes, System.Data.EvaluateException: 'Cannot find column [System.String].' and indicate to this code dv.RowFilter = "Convert(System.String, MobileNo) LIKE '%" + txtSrchBar.Text.ToString() + "%' ";
Laxmidhar SahooRank #383 · 6.6K reputationPosted Nov 20, 2018, 8:53 PM EST
Rizwan Ahmed79 reputationPosted Nov 21, 2018, 12:30 AM EST
Rizwan Ahmed79 reputationPosted Nov 21, 2018, 12:32 AM EST
Amit GuptaRank #190 · 12.8K reputationPosted Nov 21, 2018, 12:36 AM EST
Rizwan Ahmed79 reputationPosted Nov 21, 2018, 1:30 AM EST
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts