asp 连接MySQL 报错 ,编译器错误 '800a0409' 小白求救
asp吧
全部回复
仅看楼主
level 1
vu00uv 楼主
代码如下:
<head>
<title>MySQL连接测试</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
strconnection="dsn=mysqltest;
drive={mysql odbc 5.3 Unicode Driver};
server=localhost;uid=root;pwd=006600;database=mm"
set conn =server.createobject("adodb.connection")
conn.open strconnection
sql="select *from my"
set rs =conn.execute(sql)
if not rs.bof then
%>
<table width=600 border=1>
<tr>
<td width=""><b>name</b></td>
<td width=""><b>sex</b></td>
</tr>
<%
do while not rs.eof
%>
<tr>
<td><%=rs("name")%></td> <!-- name字段 -->
<td><%=rs("sex")%></td> <!-- sex字段 -->
</tr>
<%
rs.movenext
loop
%>
</table>
<%
rs.close
else
response.write("对不起,没有找到数据。")
end if
set rs = nothing
conn.close
set conn = nothing
%>
</body>
</html>
报错如下:
Microsoft VBScript 编译器错误 *800a0409*
未结束的字符串常量
\wwwroot\test1.asp, line 8
本人小白,刚刚接触asp,求大师指导下,谢谢了
2014年08月18日 08点08分 1
level 12
你的 换行 ,换错了!
一个字符串应该在一整行!
strconnection="dsn=mysqltest;
这里不该换行,你要多行可以用行连接符,也可以拼接!
2014年08月18日 14点08分 2
谢谢,已经解决了
2014年08月19日 01点08分
1