aijava

welcome to my online log ! open java new world! Taste java charm........
posts - 1, comments - 4, trackbacks - 0, articles - 42
  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理

ASP数据库连接

Posted on 2006-11-05 00:35 阅读(136) 评论(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")&"&nbsp;")
 response.Write(rs("name")&"&nbsp;")
 response.Write(rs("http")&"&nbsp;")
 response.Write(rs("adds")&"&nbsp;")
%>

<%
'以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")&"&nbsp;")
 response.Write(rs("name")&"&nbsp;")
 response.Write(rs("http")&"&nbsp;")
 response.Write(rs("fileworks")&"&nbsp;")
%>
http://freehost13.websamba.com