定义语句:dim data1 as New ADODB.Recordset
对文本框中输入入的内容限定只能为数字、字线和破折号:只要在此text的KeyPress事件中限定KeyAscii的范围(数字KeyAscii>=48 and KeyAscii<=57)

解决方案 »

  1.   

    在SQL中数据库中定义变量:declare @变量名 as 变量类型和长度
      

  2.   

    '第二个问题
    Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii <> 8 And KeyAscii <> 45 And KeyAscii < 48 Or KeyAscii > 57 And KeyAscii < 65 Or KeyAscii > 90 And KeyAscii < 97 Or KeyAscii > 122 Then
       Beep
       KeyAscii = 0
    End If
    End Sub
      

  3.   

    '第一个问题:
    dim conn as new adodb.connection
    dim rs as new adodb.recordset