好的,我是论坛的新手,对编码也很陌生,我搜索过高低,我知道 vbscript 需要转义或 Chr() 才能使用特殊字符。在下面的代码中,我需要在“doc_no”之后连接一个“%”作为 sybase 数据库的通配符,以提取我需要出现在表中的文档编号列表。
我努力了
' " & doc_no " ' & Chr(37) " 'this returned that "&" is an invalid character
' " & doc_no " ' || Chr(37) "
' " & doc_no " ' + ""%"" " returned + as an invalid character
我尝试了每种类型的几种变体,但我在网上找不到任何类似的情况。有什么建议吗?再说一次,我的编程生涯只有 4 个月,所以请多多包涵。下面是上面的代码片段。
<%
Dim document(1024)
counter = 0
cmdString = ""
cmdString = cmdString & "SELECT dbo.dsk_obj.obj_id,"
cmdString = cmdString & " docno = dbo.dsk_obj.obj_usr_num "
cmdString = cmdString & "FROM dbo.dsk_obj "
cmdString = cmdString & "WHERE dbo.dsk_obj.obj_usr_num LIKE '" & doc_no & "' I NEED TO CONCAT. % HERE "
objRS.Open cmdString, objConn, adOpenStatic, 3, adCmdText
WHILE (objRS.EOF = False)
document(counter) = objRS("docno")
counter = counter + 1
objRS.MoveNext
WEND
objRS.Close
%>
<% FOR ii = 0 TO counter -1 %>
<%=document(ii)%>
<%
NEXT
%>
输出应该是这样的
1555307375-0001
1555307375-0002
1555307375-0003
任何帮助将不胜感激!谢谢!杰里米