关于sql语句内变量的替换问题
sql="SELECT*FROM[Main]WHERE[aaa]like'%"&z_so2&"%'"想把[aaa]变成变量,不知道如何连接?高手帮下Dimz_so1Dim...
sql = "SELECT * FROM [Main] WHERE [aaa] like '%"&z_so2&"%' "
想把 [aaa] 变成 变量,不知道如何连接?高手帮下
Dim z_so1
Dim z_so2
z_so1 = request.Form("y_so1")
z_so2 = request.Form("y_so2")
'Response.Write z_so2 获取值测试
Dim sql
Dim oRs
sql = "SELECT * FROM [YZW_Main] WHERE 'z_so2' like '%"&z_so2&"%' "
Set oRs = Server.CreateObject("ADODB.RecordSet")
oRs.Open sql,oConn 展开
想把 [aaa] 变成 变量,不知道如何连接?高手帮下
Dim z_so1
Dim z_so2
z_so1 = request.Form("y_so1")
z_so2 = request.Form("y_so2")
'Response.Write z_so2 获取值测试
Dim sql
Dim oRs
sql = "SELECT * FROM [YZW_Main] WHERE 'z_so2' like '%"&z_so2&"%' "
Set oRs = Server.CreateObject("ADODB.RecordSet")
oRs.Open sql,oConn 展开
1个回答
展开全部
String sql = "UPDATE bus SET amount = amount-"+count+" WHERE busnum='addpid' ";能进行加减运算的就不是字符串,就不要单引号。count是做变量用,自然也不用加引号,加引号就变成了字符串常量,用加号将各部分连接起来就好了
追问
Dim z_so1
Dim z_so2
z_so1 = request.Form("y_so1")
z_so2 = request.Form("y_so2")
sql = "SELECT * FROM [YZW_Main] WHERE y_so1 like z_so2"
语句如何才能正确执行?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询