Data type mismatch in criteria expression

后端 未结 2 1183
梦谈多话
梦谈多话 2021-01-27 18:01
 myConnection.Open()
    rtb_Address.Clear()
    txt_Name.Clear()
    Dim str As String
    str = \"SELECT * FROM table1 WHERE (cus_ID = \'\" & txt_ID.Text & \"\         


        
2条回答
  •  隐瞒了意图╮
    2021-01-27 18:48

    cus_ID is probaly a numeric data type, but you try to query it with a string: (cus_ID = 'thevalue').

    Just remove the enclosing ': (cus_ID = thevalue)

    or better, use a parameterized query to prevent sql-injection.

提交回复
热议问题