asp操作SQLServer

connview_sql.asp 内容

<%
option explicit
response.write("ASP连接查询sqlserver<hr size='1'>")
dim conn
conn = "Provider=SQLOLEDB;Server=localhost;Database=database1;UID=sa;PWD=123"

dim rs,sql
sql="select * from table2"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,1
do while not rs.eof
response.write("姓名:"&rs("name")&"  工资:"&rs("pay")&"<br>")
rs.movenext
loop

rs.close
set rs=nothing
set conn=nothing
%>
 

你可能感兴趣的:(sql,table,database,sqlserver,asp)