我想做这样的事:
strCurrentName = rstAux.Fields("Name")
strCurrentMat = rstAux.Fields("ID")
Dim rstAux As Recordset
Dim rstReal As Recordset
Dim strCurrentName As String
Dim strCurrentMat As String
Set rstAux = New ADODB.Recordset
Set rstReal = New ADODB.Recordset
If( (strCurrentName = rstReal.Fields("Name")) OR (strCurrentMat = rstReal.Fields("ID")) Then
'codeee
End If在VB6上有可能吗?
我尝试了不同的方法来做到这一点,但是我总是会遇到这样的错误:
变量使用Visual 中不支持的自动化类型
好的,我明白这句话的意思,但我想知道是否有办法做到这一点。
发布于 2013-10-25 11:12:50
好的,您所有的变量都是字符串,请检查‘`rstReal.(“字段”)的返回是否也是字符串,如果不是,则进行转换。我相信名字是字符串,所以检查"ID“。
If(strCurrentName = rstReal.Fields("Name") OR (strCurrentMat = CString(rst.Fields("ID")) Then
'code code
End If发布于 2013-10-25 11:15:04
这应该是可行的:
Dim rstAux As New ADODB.Recordset
Dim rstReal As New ADODB.Recordset
Dim strCurrentName As String
Dim strCurrentMat As String
If strCurrentName = rstReal.Fields("Name").Value Or _
strCurrentMat = rstReal.Fields("ID").Value Then
'codeee
End If但是由于.Value是Field对象的默认属性,所以它也应该与您的版本一起工作。
https://stackoverflow.com/questions/19587746
复制相似问题