1、<%dim conn dim connstr dim db dim title title="::易元和个人工作室::" db="mdb/#oplan_pic.mdb" '数据库文件的位置 Set conn = Server.CreateObject("ADODB.Connection") connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db) conn.Open connstr %
2、 <%set oRs=server.CreateObject("ADODB.recordset") sSql = "SELECT * FROM NewsData where classid=2 ORDER BY ck DESC" oRs.Open sSql,Conn,0, 1 If Not oRs.Eof Then Do While Not oRs.Eof %>
4、Response.Write "现在数据库中还没有新闻!" End If oRs.Close %>access数据库连接用dsn连接并且没有用户名和密码:<%setconn=server.createobject("adodb.connection")conn.open"yourdsnname"%>用dsn连接并且有用户名和密码:<%setconn=server.createobject("adodb.connection")conn.open"yourdsnname","username","passwo