📄 connsql.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!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=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&Server.MapPath("sc1.mdb")
conn.open
if conn.state = 1 then Response.Write("数据库打开成功!") end if
Set rs = Server.CreateObject("ADODB.Recordset")
Set rs.ActiveConnection = conn
rs.CursorType = 3
rs.open "select name from users"
i =0
DO while rs.eof = false
Response.Write("<div>"&CStr(i+1)&" " &rs.Fields("name").value&"</div>")
rs.movenext
loop
conn.close
if(conn.state = 0) then end if
set conn = nothing
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -