Posted on 2006-11-05 00:35
苑 阅读(140)
评论(0) 编辑 收藏 所属分类:
ASP/ASP.NET
<%
'以OLEDB形势访问SQL Server数据库
set con=server.CreateObject("adodb.connection")
con.connectionstring="provider=sqloledb;data source=.;uid=sa;pwd=;database=server"
con.open
set rs=server.CreateObject("adodb.recordset")
sql="select * from kop"
rs.open sql,con,2,3
response.Write(rs("id")&" ")
response.Write(rs("name")&" ")
response.Write(rs("http")&" ")
response.Write(rs("adds")&" ")
%>
<%
'以OLEDB形势访问Access数据库
set con=server.CreateObject("adodb.connection")
con.connectionstring="provider=microsoft.jet.oledb.4.0;data source="&MapPath("color.mdb")
con.open
set rs=server.CreateObject("adodb.recordset")
sql="select * from class1"
rs.open sql,con,2,3
response.Write(rs("id")&" ")
response.Write(rs("name")&" ")
response.Write(rs("http")&" ")
response.Write(rs("fileworks")&" ")
%>