就是会员中心的"我的收藏夹",我现在是想当用户点击文章“加入收藏”时,就往数据库中表User_Favorite加入"栏目ID"和自定义字段"KS_LXY"(文本型)这两个字段的内容,以便SQL查询,看了下代码,不知怎样搞,有请路过的朋友出手帮忙了,谢谢了!
代码(User\User_Favorite.asp):
<%
Select Case KS.S("Action")
Case "Add"
Dim RSAdd
InfoID=KS.ChkClng(KS.S("InfoID"))
Set RSAdd=Server.CreateObject("Adodb.Recordset")
ChannelID=KS.ChkClng(KS.S("ChannelID"))
RSADD.Open "Select * From KS_Favorite Where ChannelID=" & ChannelID & " And InfoID=" & InfoID & " And UserName='" &KSUser.UserName & "'",Conn,1,3
IF RSADD.Eof And RSADD.Bof Then
RSADD.AddNew
RSAdd(1)=KSUser.UserName
RSAdd(2)=ChannelID
RSAdd(3)=InfoID
RSAdd(4)=Now
RSAdd.Update
End IF
RSADD.Close:SET RSADD=Nothing
Case "Cancel"
InfoID=KS.S("InfoID")
InfoID=Replace(InfoID," ","")
InfoID=KS.FilterIDs(InfoID)
If InfoID="" Then
Response.Write "<script>alert('您没有选择要取消收藏的信息!');history.back();</script>"
Response.End
End If
Conn.Execute("Delete From KS_Favorite Where ID In(" & InfoID & ") And UserName='" & KSUser.UserName & "'")
End Select
%>