aspsql1.asp
来自「sql server 2005书中11到16章的全部代码」· ASP 代码 · 共 32 行
ASP
32 行
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>显示数据库表中所有记录</title>
</head>
<body>
<%
myconn=" driver={sql server};server=localhost;uid=aspnetname;pwd=123456;database=project" //连接SQl Server数据库
sqlselect="select * from 项目"
set myrecord=server.CreateObject("adodb.recordset")
myrecord.open sqlselect,myconn %>
<table border="1"><tr>
<%for i=0 to myrecord.fields.count-1 %>
<td><%=myrecord(i).name %>
<%
next %></td>
</tr>
<tr>
<% do while not myrecord.eof
for j=0 to myrecord.fields.count-1 %>
<td><%=myrecord(j)%></td>
<% next
myrecord.movenext%>
</tr>
<%loop
myrecord.close
set myrecord=nothing
%>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?