Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共3 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:sql语句传入int型参数出错

1楼
sutingrong 发表于:2012/1/16 17:48:00

求助

我是想将userId传入到sql语句里:where b.userID="+userId,   b.userID的类型是int型的

错误为:输入字符串的格式不正确。。

 

 

代码如下:

Dim userId As Integer
Dim rose As String

userId=7
rose =Vars("user_rose")
If userId<>0 Then
    If rose <>"最高权限" Then
        Tables("入库表_Table1").Fill("SELECT a.HP_BH AS '序列号',a.HP_Name as '设备名称',b.MX_SQR as '申请人',b.MX_SQRPhone as '联系电话',b.MX_SQTime as '入库时间',b.MX_LY as '设备来源' from CK_MX AS b left join CK_HP as a on a.HP_ID = b.HP_ID  where b.userID="+userId, "ck",True)
    Else
        Tables("入库表_Table1").Fill("SELECT a.HP_BH AS '序列号',a.HP_Name as '设备名称',b.MX_SQR as '申请人',b.MX_SQRPhone as '联系电话',b.MX_SQTime as '入库时间',b.MX_LY as '设备来源' from CK_MX AS b left join CK_HP as a on a.HP_ID = b.HP_ID ","ck",True)
    End If
End If

 

 

 

2楼
狐狸爸爸 发表于:2012/1/16 17:51:00

Tables("入库表_Table1").Fill("SELECT a.HP_BH AS '序列号',a.HP_Name as '设备名称',b.MX_SQR as '申请人',b.MX_SQRPhone as '联系电话',b.MX_SQTime as '入库时间',b.MX_LY as '设备来源' from CK_MX AS b left join CK_HP as a on a.HP_ID = b.HP_ID  where b.userID=" & userId, "ck",True)

 

foxtable中,字符串用&连接起来:

http://www.foxtable.com/help/topics/0221.htm

3楼
sutingrong 发表于:2012/1/16 18:01:00
原来是这样的啊,呵呵谢谢狐狸爸爸
共3 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .02344 s, 2 queries.