方法一:

<html>
<head>
<title></title>
</head>
<body>
<%
 Set Conn=Server.CreateObject("ADODB.Connection")
 
 Conn.Open "Provider = Sqloledb; User ID = sa; Password = 123; Initial Catalog = factory; Data Source = localhost,1433;"

 set rs = Server.CreateObject("ADODB.recordset")
rs.Open "SELECT * FROM worker", conn
   
 do until rs.EOF
  for each x in rs.Fields
    Response.Write(x.name)
    Response.Write(" = ")
    Response.Write(x.value & "<br />") 
  next
  Response.Write("<br />")
  rs.MoveNext
loop

rs.close
conn.close
%>
</body>
</html>

方法二:

<html>
<head>
<title></title>
</head>
<body>
<%
 Set Conn=Server.CreateObject("ADODB.Connection")
 
Conn.Open "Driver=SQL Server;Database=factory;Server=localhost,1433;UID=sa;PWD=123;"

 set rs = Server.CreateObject("ADODB.recordset")
rs.Open "SELECT * FROM worker", conn
   
 do until rs.EOF
  for each x in rs.Fields
    Response.Write(x.name)
    Response.Write(" = ")
    Response.Write(x.value & "<br />") 
  next
  Response.Write("<br />")
  rs.MoveNext
loop

rs.close
conn.close
%>
</body>
</html>
Last modification:November 19th, 2019 at 08:20 pm
如果觉得我的文章对你有用,请随意赞赏