PDA

View Full Version : Help with "Show Region & Recordset".


malhyp
11-15-2006, 09:36 AM
Hi there can anyone help with the problem here.

I have a recordset in an asp page in Dreamweaver and a Show Region called "Show if Recordset is not empty"

When doing a search in a database, if a particular column called "Description" has nothing in it, i would like for the word "DETAIL" to not appear in the results page. This word always appears if there is something in the "Description" column or not.

in the recordset that I have created just for this function I have set the Column to "Selected" and selected the "Description" column. Under that in the "Filter" tab I have selected the "Description" column and then selected "=", "Session Variable", entered the word Description where it allows you to and I have not selected any sort function.

Either way no matter how I set this I either get the word "DETAIL" on every search I do, even though some of the search results do and dont have anything in the detail page and when i play with the settings i get nothing on all of them.

Can anyone help?

davidj
11-15-2006, 10:07 AM
post your code

malhyp
11-15-2006, 10:27 AM
Hi David, i have included what I think you need.

Show If Recordset;
<% If Not rsSupplierDestinction.EOF Or Not rsSupplierDestinction.BOF Then %>
<p align="left"><strong><a href="Description.asp?<%= MM_keepNone & MM_joinChar(MM_keepNone) & "SupplierName=" & rsSearchResult.Fields.Item("SupplierName").Value %>">More
Details</a></strong></p>
<% End If ' end Not rsSupplierDestinction.EOF Or NOT rsSupplierDestinction.BOF %>

Recordset;
<%
Dim rsSupplierDestinction
Dim rsSupplierDestinction_numRows
Set rsSupplierDestinction = Server.CreateObject("ADODB.Recordset")
rsSupplierDestinction.ActiveConnection = MM_conn_STRING
rsSupplierDestinction.Source = "SELECT Description FROM tblSuppliers WHERE Description = '" + Replace(rsSupplierDestinction__MMColParam, "'", "''") + "'"
rsSupplierDestinction.CursorType = 0
rsSupplierDestinction.CursorLocation = 2
rsSupplierDestinction.LockType = 1
rsSupplierDestinction.Open()
rsSupplierDestinction_numRows = 0
%>

davidj
11-15-2006, 10:32 AM
is this take from results page

malhyp
11-15-2006, 10:34 AM
In the recordset above when i test in in Dreamweaver it works fine. For example I have 10 results in the database and only one of them has the text "Description" in the description column. The other 9 results have nothing on the description column.

When I test it in the Dreamweaver recordset it only shows me one result. This to me means that it works. I then apply the Show only when not empty recordset.

When I upload the file and test it on the server, I do a search and all the results still come up with the text "DETAIL"

The "DETAIL" text is a "Go to deail page link".

malhyp
11-15-2006, 10:35 AM
Yes it is take from the results page.

davidj
11-15-2006, 10:43 AM
ok

you need to wrap an IF condition around...


<a href="Description.asp?<%= MM_keepNone & MM_joinChar(MM_keepNone) & "SupplierName=" & rsSearchResult.Fields.Item("SupplierName").Value %>">More
Details</a>


im not an ASP developer so this is a guess...


<% IF rsSearchResult.Fields.Item("description").Value NOT '' THEN %>
<a href="Description.asp?<%= MM_keepNone & MM_joinChar(MM_keepNone) & "SupplierName=" & rsSearchResult.Fields.Item("SupplierName").Value %>">More
Details</a>
<% END IF %>

malhyp
11-15-2006, 11:25 AM
It came up with an error message but I think I know what you mean. i will play with the asp and should get it.

Thanks heaps David

:)