sql执行时给的参数是:""""@#" 时报错,得到的recordset是nothing 在程序中用这个数据集时报错
请问:有什么办法防止用户输入此类字符(或检测到后提示用户)

解决方案 »

  1.   

    '
    '禁止输入特殊字符串(因为此类字符在SQL中的其它含义
    '函数:LeachKeyCode
    '参数:KeyCode ASCII码.LeachCode 自定义过滤字符串.
    '返回值:无
    '注:一般应用于KEYDOWN事件中.
    Public Function LeachKeyCode(ByRef KeyCode As Integer, Optional LeachCode As String = "%?#[]&-@")
                Dim I As Long
                If Len(LeachCode) = 0 Then Exit Function
                If InStr(1, LeachCode, Chr(KeyCode), vbBinaryCompare) > 0 Then KeyCode = 0
    End Function
      

  2.   

    """"@#"
    都是sql里的保留字在传入时
    用instr()判断
      

  3.   

    a error is in the website ,give the  later