好郁闷的函数,总报错
错误类型:
Microsoft VBScript 编译器错误 (0x800A0401)
语句未结束
/wzyywhb/include/library.asp, line 84, column 46
sql = "select * from table1 where hb_hbdh= "&aaaa& " "
我的思路:
在info.asp的一个form中有个表格,通过 <%call list(request.Form( "hb_hbdh "))%> 调用
函数如下:
sub shlist(aaaa)
set rs = Server.CreateObject( "ADODB.RecordSet ")
'dim hbdh
'hbdh=request.Form( "hb_hbdh ")
sql = "select * from table1 where hb_hbdh= "&aaaa& " "
rs.Open sql,conn,1,2
If RS.Eof And RS.Bof Then
Response.Write( "没有审核记录 ")
Else
Do While Not RS.Eof
Response.Write(rs( "branch_no "))
Response.Write( " <br> ")
RS.Movenext
loop
End if
rs.close
Set RS=Nothing
end sub
但是总报sql语法有问题,语句为结束,不知道为什么?
------解决方案--------------------response.write sql
response.end
测试输出,看看语句有没有错
我觉得如果aaaa为字符的话,那么应该为
sql = "select * from table1 where hb_hbdh= ' "&aaaa& " ' "
------解决方案--------------------楼上说的对,楼主要加单引号
------解决方案--------------------sql语句也不麻烦,放进sqlserver里面试一下看看能不能正确输出再说