恍然想起,似乎很久没有写Asp了,这下想用Asp简单的制作ajax留言板竟然感觉有点难度了,整个流程下来竟然耗时我一天,哈哈,有点慢了,还请大师多多指点。
Class BLL_Guest
Private mycom,mymod,mydal
Private LI,UL
Private DEL
'获取信息
Public Sub GetGuest()
mydal.GetGuest(Id)
End Sub
'新增信息
Public Sub Insert()
mymod.Content = Request("content")
mymod.re = Request("Re")
mymod.Addtime = Now()
mymod.Ip = request.servervariables("HTTP_X_FORWARDED_FOR")
If len(mymod.Ip)<=0 Then mymod.Ip = request.servervariables("REMOTE_ADDR")
Call mydal.Insert(mymod)
End Sub
'更新信息
Public Sub Update()
Call mydal.Update(mymod)
End Sub
'删除信息
Public Sub Delete()
mydal.Delete(Request("Id"))
End Sub
'查找信息
Public Function FindByPage()
Dim PageSize,CurrentPage,WhereValue,OrderValue,RecordCount
Dim objRS
Dim tmp1,tmp2,tmp3,parms,i
Dim tCMD
tCMD = Request("tCMD")
PageSize = "8"
CurrentPage = Request("PageNo")
If Len(CurrentPage)<=0 Then
CurrentPage=1
End If
WhereValue = ""
OrderValue = "Id"
Set objRS = mydal.FindByPage(PageSize,CurrentPage-1,WhereValue,OrderValue)
i = 1
RecordCount = mydal.Count(WhereValue)
Do While Not objRS.EOF
If tCMD="DEL" Then
DEL = "删除"
Else
DEL = ""
End If
parms=Array(i,objRS("content"),objRS("ip"),objRS("addtime"),DEL)
tmp1 = tmp1 & mycom.Format(LI,parms)
objRs.Movenext
i = i + 1
Loop
tmp3 = mycom.Page(PageSize,CurrentPage,RecordCount,"guest/index.asp?tCMD=LIST")
parms=Array(tmp1,tmp3)
tmp2 = tmp2 & mycom.Format(UL,parms)
FindByPage = tmp2
End Function
Private Sub Class_Initialize()
LI = " >
'/// 连接字符
'/// sql命令
'///
Public Function Recordset(connString,cmdText)
Dim objConn,objRS
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open connString
Set objRS = Server.CreateObject("ADODB.RecordSet")
objRS.Open cmdText,objConn,1,3
Set Recordset = objRS
End Function
Private Sub Class_Initialize()
CONN_STRING = "provider = microsoft.jet.oledb.4.0;data source=" & Server.Mappath("db.mdb")
End Sub
End Class
%>
小编带来的这篇Asp简单的制作ajax留言板,是不是特别的实用呢,更多相关的内容,可以多多关注下错新技术频道,我们会不断的更
新闻热点
疑难解答
图片精选