mysql - 无法对 System.Int32 和 System.String 执行 'Like' 操作。与 MySQL VB.Net

标签 mysql vb.net

我不知道为什么这个错误仍然出现。它说要转换字符串,但我认为它已经是字符串格式了。有什么解决方案?

Private Sub txtSearch_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtSearch.TextChanged
    Dim DV As New DataView(dbDataSet)
    DV.RowFilter = String.Format("emp_no Like '%{0}%'", txtSearch.Text)
    DataGridView1.DataSource = DV
End Sub

最佳答案

这样试试

Private Sub txtSearch_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtSearch.TextChanged
    Dim DV As New DataView(dbDataSet)
    DV.RowFilter = String.Format("Convert(emp_no,'System.String') Like '%{0}%'", txtSearch.Text)
    DataGridView1.DataSource = DV
End Sub

关于mysql - 无法对 System.Int32 和 System.String 执行 'Like' 操作。与 MySQL VB.Net,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23968298/

相关文章:

mysql - 如何将SQL查询的结果输出到报表表中?

php - 如果表中不存在行,则 MYSQL 查询不起作用

php - 通过 PDO+mySQL 排序不起作用

php - 从自己的 CMS 中的 wp_postmeta 提取数据

vb.net - 如何打开 .db 悖论文件

mysql - 外键可以多次使用吗?

.net - 关于组合框的问题

c# - (VB.NET) 'VB6' 未声明。由于其保护级别,它可能无法访问

mysql - 使用参数更新 MySQL 记录不起作用

database - 来自数据库的 Winforms 数据跨多种形式