#12004/4/17 10:04:36
首先定义了一个session变量:Session("friend_id")
friend_id=replace(recordset1("friend_id"),"|","','") '用','代替|
friend_id=left(friend_id,len(friend_id)-2)
friend_id=right(friend_id,len(friend_id)-2)
Session("friend_id")="("+friend_id+")"
最终Session("friend_id")的值类似于('aaaa,'bbbb','cccc'),这一步没有问题。
然后定义了一个记录集,满足的条件(where)是字段id值等于Session("friend_id")中的任何一个:
Dim Recordset4__MMColParam
Recordset4__MMColParam = "1"
If (Session("friend_id") <> "") Then
Recordset4__MMColParam = Session("friend_id")
End If
Dim Recordset4
Dim Recordset4_numRows
Set Recordset4 = Server.CreateObject("ADODB.Recordset")
Recordset4.ActiveConnection = MM_DHUalumni_STRING
Recordset4.Source = "SELECT realname FROM user_info WHERE id IN " + Session("friend_id") + "ORDER BY read ASC, time DESC"
Recordset4.CursorType = 0
Recordset4.CursorLocation = 2
Recordset4.LockType = 3
Recordset4.Open()
Recordset4_numRows = 0
我想问的是,sql语句是不是应该像上面的那样写? :(
编辑历史:[此帖最近一次被 allinhands 编辑过(编辑时间:2004-04-17 18:15:07)]