首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

请问标准表达式中数据类型不匹配的有关问题

2012-04-19 
请教标准表达式中数据类型不匹配的问题如图If Check1.Value Thenscp and & Combo2.Text & & T

请教标准表达式中数据类型不匹配的问题
如图 


If Check1.Value Then
  scp = " and " & Combo2.Text & " = " & Text1.Text & ""
Else
  scp = ""
End If
  Dim scp1 As String

If Check2.Value Then
  scp1 = " and " & Combo3.Text & " = " & Text2.Text & ""
Else
  scp1 = ""
End If
   
SQL = "select * from " & Combo1.Text & " where 1=1 " & scp & scp1

执行后,错误提示标准表达式中数据类型不匹配
查看数据库内数据类型都是文本,请教什么原因

[解决办法]
If Check1.Value Then
scp = " and " & Combo2.Text & " = '" & Text1.Text & "'"
Else
scp = ""
End If
Dim scp1 As String

If Check2.Value Then
scp1 = " and " & Combo3.Text & " = '" & Text2.Text & "'"
Else
scp1 = ""
End If

SQL = "select * from " & Combo1.Text & " where 1=1 " & scp & scp1

热点排行