asp新手初连数据库 求前辈帮忙查错!
<html>
<HEAD>
<TITLE>asp11a.asp</TITLE>
</HEAD>
<body bgcolor="#FFFFFF">
<%
call query2table("select * from publishers where name like \'A%%\'")
' 将表 publishers 中所有姓名中有字母 A 的记录查询出来
%>
<!--#include virtual="/asptest/subdbtable.inc"-->
</BODY>
</html>
下面是subdbtable.inc文件
<%
sub query2table(inputquery)
set conntemp=server.createobject("adodb.connection")
conntemp.open "DSN=longan;uid=sa;pwd=zw112358"
set rstemp=conntemp.execute(inputquery) '执行SQL语句并把返回结果保存到rstemp
howmanyfields=rstemp.fields.count -1
' 统计数据库中的列数
%>
<table border=1><tr>
<%
for i=0 to howmanyfields
%>
<td><b><%=rstemp(i).name%></B></TD>
<% next %>
</tr>
<%
do while not rstemp.eof
%>
<tr>
<% for i = 0 to howmanyfields
thisvalue=rstemp(i)
If isnull(thisvalue) then
thisvalue="" ' 如果字段为空,则将变量 thisvalue 的值定义为一个空格
end if%>
<td valign=top><%=thisvalue%></td>
<% next %>
</tr>
<%rstemp.movenext
loop%>
</table>
<%
rstemp.close
set rstemp=nothing
conntemp.close
set conntemp=nothingend
end sub
%>
运行时报subdbtable.inc的第五行有语法错误如下
错误类型:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Microsoft][ODBC SQL Server Driver][SQL Server]'A%%\' 附近有语法错误。
/asptest/subdbtable.inc, 第 5 行