末日人机奖励给什么:asp问题 关于字符串的连接

来源:百度文库 编辑:神马品牌网 时间:2024/04/29 22:04:57
在asp中有一个sql语句
sql = "select * from type1"
如果type1中的1的值是上一个网页用
strtype=request("type")传递过来的
现在把这个数字赋给了字符串strtype
那么现在这个查询语句是怎么写的 ?我试着写了一下
是不是这样的 ?
sql = "select * from type" + strtype " "
这样对吗?不对应该怎么写?

asp语言字符串相加直接用数学里面的加号就可以了,也可以用"&"连接两个字符串

应该这样写:
Dim strtype
strtype = Request("type")
sql = "select * from type where id = " & strtype
或者
sql = "select * from type where id = "&strtype&""

type=type&strtype
sql = "select * from type"