<
%
Response.Write( " ************************* " & " <br> " )
Response.Write( " Neok的ASP程序的第一个测试 " & " <br> " )
Response.Write( " ************************* " & " <br> " )
' 示例:ASP连接Access数据库,无密码连接
DBPath = Server.MapPath( " myData.mdb " ) ' 数据库存放路径
Strconn = " DRIVER=Microsoft Access Driver (*.mdb);DBQ= " & DBPath ' 连接字符串
Set conn = Server.CreateObject( " ADODB.Connection " ) ' 新建一个连接
conn.open Strconn
Set rs = Server.CreateObject( " ADODB.RecordSet " ) ' 新建一个查询
strSQL = " SELECT * FROM TBL_USER " ' 查询的SQL语句
rs.Open strSQL,conn, 1 , 1 ' 执行查询
' Response.Write rs("UserName") '获取UserName字段的值
' **********
do while not rs.eof
% >
< table width = " 100% " border = " 1 " >
< tr >
< td width = " 150 " >< % = rs( " UserName " )% ></ td >
< td width = " 150 " >< % = rs( " PassWord " )% ></ td >
< td width = " 150 " >< % = rs( " INFO " )% ></ td >
</ tr >
</ table >
< %
rs.movenext
loop
' **********
rs.close
set rs = nothing
conn.close
set conn = nothing
% >
Response.Write( " ************************* " & " <br> " )
Response.Write( " Neok的ASP程序的第一个测试 " & " <br> " )
Response.Write( " ************************* " & " <br> " )
' 示例:ASP连接Access数据库,无密码连接
DBPath = Server.MapPath( " myData.mdb " ) ' 数据库存放路径
Strconn = " DRIVER=Microsoft Access Driver (*.mdb);DBQ= " & DBPath ' 连接字符串
Set conn = Server.CreateObject( " ADODB.Connection " ) ' 新建一个连接
conn.open Strconn
Set rs = Server.CreateObject( " ADODB.RecordSet " ) ' 新建一个查询
strSQL = " SELECT * FROM TBL_USER " ' 查询的SQL语句
rs.Open strSQL,conn, 1 , 1 ' 执行查询
' Response.Write rs("UserName") '获取UserName字段的值
' **********
do while not rs.eof
% >
< table width = " 100% " border = " 1 " >
< tr >
< td width = " 150 " >< % = rs( " UserName " )% ></ td >
< td width = " 150 " >< % = rs( " PassWord " )% ></ td >
< td width = " 150 " >< % = rs( " INFO " )% ></ td >
</ tr >
</ table >
< %
rs.movenext
loop
' **********
rs.close
set rs = nothing
conn.close
set conn = nothing
% >