Forums

ASP

This topic is locked

HElp with recordset

Posted 18 Mar 2007 15:12:25
1
has voted
18 Mar 2007 15:12:25 lou castro posted:
Using DWMX and access Db.
I am no expert, but can usually figure things out by myself, but this is driving me crazy. I have 2 tables, one for receiving (receivingID primary key, shipper, arrival date etc) the other for details (detID PK, receivingID, weight, grades, counts etc.).
I have a page showing the receiving documents, and a link to show the details of the record. All using repeat region. I should mention the link passes the receivingID to the detail page. However, it doesnt matter what record I choose, it shows the details for the first record.
The recordset I used was
SELECT *
FROM RecDetails
WHERE RecievingID = MMColParam

MMColParam being the variable passed (default value = 1...therefore showing only receivingID 1)

So the bottom line is, why is the correct receivingID not being passed? I have tested the SQL in access and it works fine, but on the ASP page, it does not work. Im sure its something dumb Im overlooking, but teh more I look at it, the less Im seeing.
Thanks!!!

Replies

Replied 18 Mar 2007 18:35:38
18 Mar 2007 18:35:38 Javier Castro replied:
in your server beahaviours you have to apply to your detail Page, under Recordset Paging --> Move to Specific Record and when asked select the appropriate recordset. That should solve your problem.

Good luck ,

Javier
Replied 19 Mar 2007 01:09:20
19 Mar 2007 01:09:20 lou castro replied:
thanks for your response....by the way, are we related????
Anyway, I have already applied GO TO DETAIL PAGE behavior, but the only record that shows is #1.

The recieving.asp shows all recieving documents, and it should show the details of that document on the receivingdetails.asp page. I have applied the GO TO DETAILS behavior on the receiving.asp page, but the details shown are only for record # 1.
I must also point out that there is another link that edits the receiving document, and that works fine!

What do you think?
Replied 19 Mar 2007 02:17:13
19 Mar 2007 02:17:13 Javier Castro replied:
OK. Then, try changing the default variable to 0 instead of One.
can you post your pages...do you have an URL where we can see them?

Also, make sure you have on your details page, on the Server Behaviours, check If you already have applied, the : Move To Specific Record if that doesn't work, Check the difference between your link that works and the one that doesn't.

Related???? ummm... maybe.... <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>
Replied 19 Mar 2007 04:07:46
19 Mar 2007 04:07:46 lou castro replied:
Here are teh 2 pages in question: the recieving.asp and receivingdetails.aps

receiving.asp:
&lt;%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%&gt;
&lt;!--#include file="Connections/nuwave.asp" --&gt;
&lt;%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset"
Recordset1.ActiveConnection = MM_nuwave_STRING
Recordset1.Source = "SELECT * FROM Receiving ORDER BY RecievingID DESC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%&gt;
&lt;%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%&gt;
&lt;%
Dim MM_paramName
%&gt;
&lt;%
' *** Go To Record and Move To Record: create strings for maintaining URL and Form parameters

Dim MM_keepNone
Dim MM_keepURL
Dim MM_keepForm
Dim MM_keepBoth

Dim MM_removeList
Dim MM_item
Dim MM_nextItem

' create the list of parameters which should not be maintained
MM_removeList = "&index="
If (MM_paramName &lt;&gt; "" Then
MM_removeList = MM_removeList & "&" & MM_paramName & "="
End If

MM_keepURL=""
MM_keepForm=""
MM_keepBoth=""
MM_keepNone=""

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

' add the Form variables to the MM_keepForm string
For Each MM_item In Request.Form
MM_nextItem = "&" & MM_item & "="
If (InStr(1,MM_removeList,MM_nextItem,1) = 0) Then
MM_keepForm = MM_keepForm & MM_nextItem & Server.URLencode(Request.Form(MM_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 &lt;&gt; "" Then
MM_keepBoth = Right(MM_keepBoth, Len(MM_keepBoth) - 1)
End If
If (MM_keepURL &lt;&gt; "" Then
MM_keepURL = Right(MM_keepURL, Len(MM_keepURL) - 1)
End If
If (MM_keepForm &lt;&gt; "" Then
MM_keepForm = Right(MM_keepForm, Len(MM_keepForm) - 1)
End If

' a utility function used for adding additional parameters to these strings
Function MM_joinChar(firstItem)
If (firstItem &lt;&gt; "" Then
MM_joinChar = "&"
Else
MM_joinChar = ""
End If
End Function
%&gt;
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;p&gt;&lt;a href="addreceiving.asp"&gt;Add receiving Document&lt;/a&gt; | &lt;a href="index.asp"&gt;Main Menu&lt;/a&gt;&lt;/p&gt;
&lt;table width="90%" border="0" cellspacing="0" cellpadding="0"&gt;
&lt;tr bgcolor="#CCCCCC"&gt;
&lt;td&gt;&nbsp;&lt;/td&gt;
&lt;td&gt;Entry # &lt;/td&gt;
&lt;td&gt;Ref # &lt;/td&gt;
&lt;td&gt;Origin&lt;/td&gt;
&lt;td&gt;Shipper&lt;/td&gt;
&lt;td&gt;Importer&lt;/td&gt;
&lt;td&gt;Shipment # &lt;/td&gt;
&lt;td&gt;Ship Via &lt;/td&gt;
&lt;td&gt;Arrival date &lt;/td&gt;
&lt;td&gt;&nbsp;&lt;/td&gt;
&lt;td&gt;&nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;%
While ((Repeat1__numRows &lt;&gt; 0) AND (NOT Recordset1.EOF))
%&gt;
&lt;tr&gt;
&lt;td&gt;&nbsp;&lt;/td&gt;
&lt;td&gt;&lt;%=(Recordset1.Fields.Item("EntryNumber".Value)%&gt;&lt;/td&gt;
&lt;td&gt;&lt;%=(Recordset1.Fields.Item("RefNumber".Value)%&gt;&lt;/td&gt;
&lt;td&gt;&lt;%=(Recordset1.Fields.Item("Origin".Value)%&gt;&lt;/td&gt;
&lt;td&gt;&lt;%=(Recordset1.Fields.Item("Shipper".Value)%&gt;&lt;/td&gt;
&lt;td&gt;&lt;%=(Recordset1.Fields.Item("Importer".Value)%&gt;&lt;/td&gt;
&lt;td&gt;&lt;%=(Recordset1.Fields.Item("ShipmentNumber".Value)%&gt;&lt;/td&gt;
&lt;td&gt;&lt;%=(Recordset1.Fields.Item("ShipVia".Value)%&gt;&lt;/td&gt;
&lt;td&gt;&lt;%=(Recordset1.Fields.Item("Arrivaldate".Value)%&gt;&lt;/td&gt;
&lt;td&gt;&lt;A HREF="editreceiving.asp?&lt;%= Server.HTMLEncode(MM_keepNone) & MM_joinChar(MM_keepNone) & "RecievingID=" & Recordset1.Fields.Item("RecievingID".Value %&gt;"&gt;&lt;img src="Images/icon_pencil.gif" alt="Edit Record" width="12" height="12" border="0"&gt;&lt;/A&gt;&lt;/td&gt;
&lt;td&gt;&lt;A HREF="receivingdetails.asp?&lt;%= Server.HTMLEncode(MM_keepForm) & MM_joinChar(MM_keepForm) & "RecievingID=" & Recordset1.Fields.Item("RecievingID".Value %&gt;"&gt;&lt;img src="Images/add.jpg" alt="Add to this document" width="12" height="12" border="0"&gt;&lt;/A&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%&gt;

&lt;/table&gt;
&lt;p&gt;&nbsp;&lt;/p&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;%
Recordset1.Close()
Set Recordset1 = Nothing
%&gt;



Heres teh 2nd page:

&lt;%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%&gt;
&lt;!--#include file="Connections/nuwave.asp" --&gt;
&lt;%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "1"
If (Request.QueryString("ReceivingID" &lt;&gt; "" Then
Recordset1__MMColParam = Request.QueryString("ReceivingID"
End If
%&gt;
&lt;%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset"
Recordset1.ActiveConnection = MM_nuwave_STRING
Recordset1.Source = "SELECT * FROM RecDetails WHERE RecievingID = " + Replace(Recordset1__MMColParam, "'", "''" + " ORDER BY RecDetailID ASC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%&gt;
&lt;%
Dim Repeat1__numRows
Dim Repeat1__index

Repeat1__numRows = -1
Repeat1__index = 0
Recordset1_numRows = Recordset1_numRows + Repeat1__numRows
%&gt;
&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;table width="90%" border="1" cellspacing="0" cellpadding="0"&gt;
&lt;tr&gt;
&lt;td&gt;&lt;table width="100%" border="0" cellspacing="0" cellpadding="0"&gt;
&lt;tr&gt;
&lt;td&gt;&nbsp;&lt;/td&gt;
&lt;td&gt;&nbsp;&lt;/td&gt;
&lt;td&gt;&nbsp;&lt;/td&gt;
&lt;td&gt;&nbsp;&lt;/td&gt;
&lt;td&gt;&nbsp;&lt;/td&gt;
&lt;td&gt;&nbsp;&lt;/td&gt;
&lt;td&gt;&nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;%
While ((Repeat1__numRows &lt;&gt; 0) AND (NOT Recordset1.EOF))
%&gt;
&lt;tr&gt;
&lt;td&gt;&lt;%=(Recordset1.Fields.Item("BoxNumber".Value)%&gt;&lt;/td&gt;
&lt;td&gt;&lt;%=(Recordset1.Fields.Item("Species".Value)%&gt;&lt;/td&gt;
&lt;td&gt;&lt;%=(Recordset1.Fields.Item("WeightK".Value)%&gt;&lt;/td&gt;
&lt;td&gt;&lt;%=(Recordset1.Fields.Item("WeightL".Value)%&gt;&lt;/td&gt;
&lt;td&gt;&lt;%=(Recordset1.Fields.Item("OurWeight".Value)%&gt;&lt;/td&gt;
&lt;td&gt;&nbsp;&lt;/td&gt;
&lt;td&gt;&nbsp;&lt;/td&gt;
&lt;/tr&gt;
&lt;%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%&gt;

&lt;/table&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;
&lt;%
Recordset1.Close()
Set Recordset1 = Nothing
%&gt;

Reply to this topic