主题:  关于ID对应

chinaware

职务:普通成员
等级:1
金币:0.0
发贴:25
注册:2002/5/18 10:09:16
#12002/5/18 10:14:19
我用ud做了个登陆系统,注册、登陆都是好的,写入数据库也OK,但现在我发现登陆后的ID 与我登陆用户名的ID 不对应。{Session.mm_username} 反馈的是我用来登陆的用户名,而{Recordset1.id}和{Recordset1.user}反馈回来的总是id是“1”。

我想问题就在下面这段中的Recordset1__MMColParam = "1" ,它总是取ID=1 不会变化,我改成Recordset1__MMColParam = "2"它就说是取ID=2 .下面的图是在UD中设置的样子,帮帮我啊!!!!

<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
if (Request.QueryString("id") <> "") then Recordset1__MMColParam = Request.QueryString("id")
%>
<%
set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_test_STRING
Recordset1.Source = "SELECT * FROM db_user WHERE id = " + Replace(Recordset1__MMColParam, "'", "''") + ""
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 3
Recordset1.Open()
Recordset1_numRows = 0
%>
<%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName <> "") Then MM_removeList = MM_removeList & "&" & MM_paramName & "="
MM_keepURL="":MM_keepForm="":MM_keepBoth="":MM_keepNone=""

' add the URL parameters to the MM_keepURL string
For Each Item In Request.QueryString
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepURL = MM_keepURL & NextItem & Server.URLencode(Request.QueryString(Item))
End If
Next

' add the Form variables to the MM_keepForm string
For Each Item In Request.Form
NextItem = "&" & Item & "="
If (InStr(1,MM_removeList,NextItem,1) = 0) Then
MM_keepForm = MM_keepForm & NextItem & Server.URLencode(Request.Form(Item))
End If
Next

' create the Form + URL string and remove the intial '&' from each of the strings
MM_keepBoth = MM_keepURL & MM_keepForm
if (MM_keepBoth <> "") Then MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
if (MM_keepURL <> "") Then MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
if (MM_keepForm <> "") Then MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem <> "") Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%>






I''MAD

职务:普通成员
等级:8
金币:11.0
发贴:9502
注册:2001/9/16 20:00:53
#22002/5/18 10:57:44
你那个ID根本没有传递值过来,所以它只能使用默认的值。看看你的前一页面有没有用URL提交值过来吧。



chinaware

职务:普通成员
等级:1
金币:0.0
发贴:25
注册:2002/5/18 10:09:16
#32002/5/18 11:05:40
请问怎么样提交 ?请告诉我,谢谢



I''MAD

职务:普通成员
等级:8
金币:11.0
发贴:9502
注册:2001/9/16 20:00:53
#42002/5/18 11:22:08
首先,你这个页面的记录集是通过接收前一个页面传递过来的值来建立的,即request.querystring。在它前一个页面当然就要传递这个值了,就是你的ID号,比如说你这个页面名叫text.asp,那前一个页面传递的时候它的URL就为text.asp?id=n(例),它可以是表单提交,也可以是你自己定义的。