用ASP写一段将数据库T1表中的记录绑定到页面的语句吧
- 提问者网友:浪荡绅士
- 2021-07-25 23:27
- 五星知识达人网友:鸠书
- 2021-07-25 23:56
dim conn,connStr,rs,sqlStr
Set conn = Server.CreateObject("ADODB.Connection")
connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("数据库地址")
conn.open connStr
Set rs = Server.CreateObject("ADODB.RECORDSET")
sqlStr = "select * from T1"
rs.Open sqlStr,conn,1,1
If rs.Eof Or rs.Bof Then
Response.Write("没有数据")
Else
While Not rs.Eof
Response.Write(rs("数据库字段1"))
Response.Write(rs("数据库字段2"))
...
rs.MoveNext
Wend
End If
- 1楼网友:零点过十分
- 2021-07-26 01:19
<%
dim conn,connStr,rs,sqlStr
Set conn = Server.CreateObject("ADODB.Connection")
connStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("数据库地址")
conn.open connStr
Set rs = Server.CreateObject("ADODB.RECORDSET")
sqlStr = "select * from T1"
rs.Open sqlStr,conn,1,1
If rs.Eof Or rs.Bof Then
Response.Write("没有数据")
Else
While Not rs.Eof
Response.Write(rs("数据库字段1"))
Response.Write(rs("数据库字段2"))
...
rs.MoveNext
Wend
End If
%>
- 2楼网友:封刀令
- 2021-07-26 00:39
set rs=server.createobject("adodb.recordset")
sql="select * from [T1]"
rs.open sql,conn,1,1