db_path = "../database/cnbruce2005.mdb" Set conn= Server.CreateObject("ADODB.Connection") connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="Server.MapPath(db_path) conn.Open connstr |
Set rs = Server.CreateObject ("ADODB.Recordset") sql = "Select top 5 * from [news] order by n_id desc" rs.Open sql,conn,1,1 |
do while not rs.eof response.write rs("n_title") rs.movenext loop '还有最后的关闭和释放操作 rs.close set rs=nothing |
Function topnews(tnum) Set rs = Server.CreateObject ("ADODB.Recordset") sql = "Select top "tnum" * from [news] order by n_id desc" rs.Open sql,conn,1,1 do while not rs.eof response.write rs("n_title") rs.movenext loop rs.close set rs=nothing End Function |
Class cnbruce '声明一个名为cnbruce的类 Private cnrose Private Sub Class_Initialize cnrose="My Name is cnrose." End Sub Private Sub Class_Terminate() End Sub End Class |
Class cnbruce '声明一个名为cnbruce的类 Private cnrose Private Sub Class_Initialize cnrose="My Name is cnrose." End Sub Private Sub Class_Terminate() End Sub Public Property get YName YName=cnrose End Property End Class |
% Class cnbruce Private cnrose Private Sub Class_Initialize cnrose="My Name is cnrose." End Sub Public Property get YName YName=cnrose End Property public property let MName(nnn) cnrose=nnn end property End Class Set aaa=New cnbruce aaa.MName="hahahoho" response.write aaa.YName %> |
上一篇:聊天室实现私聊第1/4页
下一篇:ASP程序代码执行时间统计类