Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What's wrong with this code

Status
Not open for further replies.

Herminio

Technical User
May 10, 2002
189
PT
i can't pass the information in Dreamweaver MX from one page to another, i want the insert record confirm page to display the user name and password the user just entered and i'm not been able to do that, this is what i have

insert.asp

<%@LANGUAGE=&quot;VBSCRIPT&quot; CODEPAGE=&quot;1252&quot;%>
<% Session(&quot;MM_UserName&quot;) = Request.Form(&quot;colect&quot;) %>
<!--#include file=&quot;Connections/teste.asp&quot; -->
<%
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables(&quot;SCRIPT_NAME&quot;))
If (Request.QueryString <> &quot;&quot;) Then
MM_editAction = MM_editAction & &quot;?&quot; & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = &quot;&quot;
%>
<%
' *** Insert Record: set variables

If (CStr(Request(&quot;MM_insert&quot;)) = &quot;form1&quot;) Then

MM_editConnection = MM_teste_STRING
MM_editTable = &quot;member&quot;
MM_editRedirectUrl = &quot;confirm.asp&quot;
MM_fieldsStr = &quot;Colect|value|password|value|morada|value|localidade|value|codpostal|value|horario|value|telefone|value|email|value|fax|value|freguesia|value|sigla|value&quot;
MM_columnsStr = &quot;Colect|',none,''|password|',none,''|morada|',none,''|localidade|',none,''|codpostal|',none,''|horario|',none,''|telefone|',none,''|email|',none,''|fax|',none,''|freguesia|',none,''|sigla|',none,''&quot;

' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, &quot;|&quot;)
MM_columns = Split(MM_columnsStr, &quot;|&quot;)

' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next

' append the query string to the redirect URL
If (MM_editRedirectUrl <> &quot;&quot; And Request.QueryString <> &quot;&quot;) Then
If (InStr(1, MM_editRedirectUrl, &quot;?&quot;, vbTextCompare) = 0 And Request.QueryString <> &quot;&quot;) Then
MM_editRedirectUrl = MM_editRedirectUrl & &quot;?&quot; & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & &quot;&&quot; & Request.QueryString
End If
End If

End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(Request(&quot;MM_insert&quot;)) <> &quot;&quot;) Then

' create the sql insert statement
MM_tableValues = &quot;&quot;
MM_dbValues = &quot;&quot;
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),&quot;,&quot;)
MM_delim = MM_typeArray(0)
If (MM_delim = &quot;none&quot;) Then MM_delim = &quot;&quot;
MM_altVal = MM_typeArray(1)
If (MM_altVal = &quot;none&quot;) Then MM_altVal = &quot;&quot;
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = &quot;none&quot;) Then MM_emptyVal = &quot;&quot;
If (MM_formVal = &quot;&quot;) Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> &quot;&quot;) Then
MM_formVal = MM_altVal
ElseIf (MM_delim = &quot;'&quot;) Then ' escape quotes
MM_formVal = &quot;'&quot; & Replace(MM_formVal,&quot;'&quot;,&quot;''&quot;) & &quot;'&quot;
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & &quot;,&quot;
MM_dbValues = MM_dbValues & &quot;,&quot;
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = &quot;insert into &quot; & MM_editTable & &quot; (&quot; & MM_tableValues & &quot;) values (&quot; & MM_dbValues & &quot;)&quot;

If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject(&quot;ADODB.Command&quot;)
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl <> &quot;&quot;) Then
Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body>
<form method=&quot;POST&quot; action=&quot;<%=MM_editAction%>&quot; name=&quot;form1&quot;>
<table align=&quot;center&quot;>
<tr valign=&quot;baseline&quot;>
<td nowrap align=&quot;right&quot;>Colect:</td>
<td> <input type=&quot;text&quot; name=&quot;Colect&quot; value=&quot;&quot; size=&quot;32&quot;> </td>
</tr>
<tr valign=&quot;baseline&quot;>
<td nowrap align=&quot;right&quot;>Password:</td>
<td> <input type=&quot;text&quot; name=&quot;password&quot; value=&quot;&quot; size=&quot;32&quot;> </td>
</tr>
<tr valign=&quot;baseline&quot;>
<td nowrap align=&quot;right&quot;>Morada:</td>
<td> <input type=&quot;text&quot; name=&quot;morada&quot; value=&quot;&quot; size=&quot;32&quot;> </td>
</tr>
<tr valign=&quot;baseline&quot;>
<td nowrap align=&quot;right&quot;>Localidade:</td>
<td> <input type=&quot;text&quot; name=&quot;localidade&quot; value=&quot;&quot; size=&quot;32&quot;> </td>
</tr>
<tr valign=&quot;baseline&quot;>
<td nowrap align=&quot;right&quot;>Codpostal:</td>
<td> <input type=&quot;text&quot; name=&quot;codpostal&quot; value=&quot;&quot; size=&quot;32&quot;> </td>
</tr>
<tr valign=&quot;baseline&quot;>
<td nowrap align=&quot;right&quot;>Horario:</td>
<td> <input type=&quot;text&quot; name=&quot;horario&quot; value=&quot;&quot; size=&quot;32&quot;> </td>
</tr>
<tr valign=&quot;baseline&quot;>
<td nowrap align=&quot;right&quot;>Telefone:</td>
<td> <input type=&quot;text&quot; name=&quot;telefone&quot; value=&quot;&quot; size=&quot;32&quot;> </td>
</tr>
<tr valign=&quot;baseline&quot;>
<td nowrap align=&quot;right&quot;>Email:</td>
<td> <input type=&quot;text&quot; name=&quot;email&quot; value=&quot;&quot; size=&quot;32&quot;> </td>
</tr>
<tr valign=&quot;baseline&quot;>
<td nowrap align=&quot;right&quot;>Fax:</td>
<td> <input type=&quot;text&quot; name=&quot;fax&quot; value=&quot;&quot; size=&quot;32&quot;> </td>
</tr>
<tr valign=&quot;baseline&quot;>
<td nowrap align=&quot;right&quot;>Freguesia:</td>
<td> <input type=&quot;text&quot; name=&quot;freguesia&quot; value=&quot;&quot; size=&quot;32&quot;> </td>
</tr>
<tr valign=&quot;baseline&quot;>
<td nowrap align=&quot;right&quot;>Sigla:</td>
<td> <input type=&quot;text&quot; name=&quot;sigla&quot; value=&quot;&quot; size=&quot;32&quot;> </td>
</tr>
<tr valign=&quot;baseline&quot;>
<td nowrap align=&quot;right&quot;>&nbsp;</td>
<td> <input type=&quot;submit&quot; value=&quot;Insert Record&quot;> </td>
</tr>
</table>
<input type=&quot;hidden&quot; name=&quot;MM_insert&quot; value=&quot;form1&quot;>
</form>
<p>&nbsp;</p>
</body>
</html>

confirm.asp

<%@LANGUAGE=&quot;VBSCRIPT&quot; CODEPAGE=&quot;1252&quot;%>
<!--#include file=&quot;Connections/teste.asp&quot; -->
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = &quot;1&quot;
If (Session(&quot;MM_UserName&quot;) <> &quot;&quot;) Then
Recordset1__MMColParam = Session(&quot;MM_UserName&quot;)
End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject(&quot;ADODB.Recordset&quot;)
Recordset1.ActiveConnection = MM_teste_STRING
Recordset1.Source = &quot;SELECT * FROM member WHERE Colect = '&quot; + Replace(Recordset1__MMColParam, &quot;'&quot;, &quot;''&quot;) + &quot;'&quot;
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
</head>

<body>
<p><%=(Recordset1.Fields.Item(&quot;Colect&quot;).Value)%> </p>
<p><%=(Recordset1.Fields.Item(&quot;password&quot;).Value)%></p>
<div align=&quot;center&quot;>
<p>&nbsp;</p>
<p>&nbsp;</p>
</div>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>

with this it gives me this error


ADODB.Field error '800a0bcd'

BOF or EOF is true or the current record was deleted; the requested operation needs a current record.

HELP ME

Herminio, Portugal

/teste/confirm.asp, line31
 
i've made it!!!

i just changed hte line that was <% session(&quot;username&quot;) = request.form(&quot;colect&quot;) %> to <% session(&quot;username&quot;) = cStr(request.form(&quot;colect&quot;)) %>

this was made with an extension i found on Macromedia's site, now i want to understand what's the difference, it's good that i make things works, but that's not enough, i need to understand why.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top