Dim Conn,ConnStr
'//创建数据库连接对象
Set Conn=Server.CreateObject("Adodb.Connection")
'//创建数据库连接字符串
ConnStr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("test.mdb") '连接ACCESS
'connstr="Driver={SQL Server};Server=127.0.0.1;UID=sa;PWD=123;Database=mis" '连接SQLSERVER
Conn.open ConnStr '打开数据库
If err Then
err.clear
Set Conn = Nothing
Response.Write "数据库连接错误,请检查连接参数!"
Response.End
End If
dim rs,sql
'//创建记录集
set rs = server.createobject("adodb.recordset")
sql="select * from 学生信息表"
rs.open sql,conn,1,1
do while not rs.eof
response.write rs(1)
//记录集循环
rs.movenext
loop
rs.close
set rs=nothing