asp 连接mysql

jjzxjgy 2010-12-22 09:19:54
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户信息查询结果</title>
</head>

<body bgcolor="#FFFFFF">
<center><h1>用户信息查询</h1></center><br/>

<% section1 =request.form("section") content1=request.form("content")%>
<% set Conn =Server.CreateObject("ADODB.Connection") Conn.Open "phone_record"
sql="select * from phone_record where "§ion1& " ="'&content1&"' Set RS=Conn.Execute(sql) %>

<p>查询时间:<%=now%></p>
<table border=2>
<font color="#213554">
<tr><%for i=0 to RS.Fields.Count-1%>
<td><b><%=RS(i).Name%></b></td>
<%NEXT%>
</tr></font>


<%Do While Not RS.Eof%>
<tr>
<%FOR i=0 TO RS.Fields.Count-1%>
<td valign =top><%=RS(i)%></td>
<%next%>
</tr>
<%
RS.MoveNext
Loop
RS.Close
%>

</table>
</body>
</html>


asp代码的语法是不是有错啊,运行不出来啊,才学asp,果断很菜啊
...全文
50 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
tsrj200916 2010-12-23
  • 打赏
  • 举报
回复
要装odbc包
LANMIN 2010-12-23
  • 打赏
  • 举报
回复
MyODBC 2.50 Local database

Driver={mySQL};Server=localhost;Option=16834;Database=myDataBase;


MyODBC 2.50 Remote database

Driver={mySQL};Server=myServerAddress;Port=3306;Option=131072;Stmt=; Database=myDataBase;Uid=myUsername;Pwd=myPassword;

MyODBC 3.51 Local database

Driver={MySQL ODBC 3.51 Driver};Server=localhost;Database=myDataBase; User=myUsername;Password=myPassword;Option=3;


MyODBC 3.51 Remote database

Driver={MySQL ODBC 3.51 Driver};Server=data.domain.com;Port=3306;Database=myDataBase;User=myUsername; Password=myPassword;Option=3;
-晴天 2010-12-22
  • 打赏
  • 举报
回复
<% 
section1 =request.form("section")
content1=request.form("content")
set Conn =Server.CreateObject("ADODB.Connection")
Conn.Open "phone_record" '这是要写上连接字符串的,如:
'"driver={sql server};server=SQLSERVERNAME;uid=sa;pwd=yourpassword;database=yourdatabase"
sql="select * from phone_record where " & section1& " ='" & content1& "'"
Set RS=Conn.Execute(sql)
%>

28,406

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧