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

Access数据库搜索语句 Instr的用法疑问.该怎么解决

2012-01-24 
Access数据库搜索语句 Instr的用法疑问.VB codeDim str_ToolID As Stringstr_ToolID labToolID.CaptionW

Access数据库搜索语句 Instr的用法疑问.

VB code
Dim str_ToolID As Stringstr_ToolID = labToolID.CaptionWIS_Search_MDB_Str = ""WIS_Search_MDB_Str = "Select A.CaseID as 日期信息,A.PNInfo,A.UseCount as 数量信息,B.Pprice as 单价 from CasePartsHistory A left join [;database=" & WIS_Base_DataBaseConnectName & "].PartsList B on A.PNInfo=B.SPnID  where  Instr(A.CaseID," & str_ToolID & ")<>0 and B.PLocation like '" & comPNLocation.Text & "%' "


运行后:提示有至少一个参数未被指定值..

应该是:

VB code
Instr(A.CaseID," & str_ToolID & ")<>0

的问题.
我的搜索结果需求是在 字段CaseID中搜索含有 str_ToolID内容的数据.比如
CaseID: 2011-03-04 231234@DEASU09, str_ToolID="DEASU09",则符合条件.
不知道是否 该 Instr的用法不对还是缺少些其他的东西...



[解决办法]
WIS_Search_MDB_Str = "Select A.CaseID as 日期信息,A.PNInfo,A.UseCount as 数量信息,B.Pprice as 单价 from CasePartsHistory A left join [;database=" & WIS_Base_DataBaseConnectName & "].PartsList B on A.PNInfo=B.SPnID where A.CaseID like '%" & str_ToolID & "%' and B.PLocation like '" & comPNLocation.Text & "%' "


热点排行