Show if recordset is empty??

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Show if recordset is empty??

    Hi,
    I have a results page with two result boxes and am trying to add 'Show if
    recordset is empty' for obvious reasons. BUT i've highlighted text (eg,
    criteria error) for one and used the show if.... which works fine but when i
    try to add it to the second box (different recordset) it doesn't, WHY??
    Anyhelp on this please?
    Ian

    longsdale Guest

  2. Similar Questions and Discussions

    1. Show region if recordset is not empty
      Hi? How can I make server behavior for this?: If Diet field empty in the food table,Don?t display Diet word in the Page <% If Not Food.EOF...
    2. Why Dreamweaver edit the Recordset will show thiserror?
      In your Connection file, change MM_Habook_STRING = 'dsn=Habook;' to MM_Habook_STRING = 'dsn=Habook;un=; pw=' Where the username and password have...
    3. recordset paging won't show second page
      Hi I'm querying a database and returning the records using absolute page and all that stuff. The user can choose to do a keyword search or...
    4. Load Empty Recordset
      Hi All, Is it possible to load an empty recordset into a page for the purpose of setting up the page for a new record? The following code (there...
    5. Set an Empty Recordset?
      You could throw in a rsQuery.Movelast Sometimes what I'll do in testing is: CONST TRAP_STOP = 10 DIM TRAP_COUNT TRAP_COUNT = 1
  3. #2

    Default Re: Show if recordset is empty??

    One working and one not but from two seperate recordsets......? In the same table but without a repeat region so that shouldn't have anything to do with it should it?
    Ian
    longsdale Guest

  4. #3

    Default Re: Show if recordset is empty??

    I think you will have to post some code to obtain assistance.

    "longsdale" <webforumsuser@macromedia.com> wrote in message
    news:d2h9jb$9l3$1@forums.macromedia.com...
    > One working and one not but from two seperate recordsets......? In the
    > same table but without a repeat region so that shouldn't have anything to
    > do with it should it?
    > Ian

    Les Matthews Guest

  5. #4

    Default Re: Show if recordset is empty??

    Does this help??

    <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
    <!--#include file="Connections/conn.asp" -->
    <%
    var result__MMColParam = "1";
    if (String(Request.Form("Product")) != "undefined" &&
    String(Request.Form("Product")) != "") {
    result__MMColParam = String(Request.Form("Product"));
    }
    %>
    <%
    var result = Server.CreateObject("ADODB.Recordset");
    result.ActiveConnection = MM_conn_STRING;
    result.Source = "SELECT Product FROM Products WHERE Product LIKE '%"+
    result__MMColParam.replace(/'/g, "''") + "%' ORDER BY Product";
    result.CursorType = 0;
    result.CursorLocation = 2;
    result.LockType = 1;
    result.Open();
    var result_numRows = 0;
    %>
    <%
    var shop__MMColParam = "1";
    if (String(Request.Form("shop")) != "undefined" &&
    String(Request.Form("shop")) != "") {
    shop__MMColParam = String(Request.Form("shop"));
    }
    %>
    <%
    var shop = Server.CreateObject("ADODB.Recordset");
    shop.ActiveConnection = MM_conn_STRING;
    shop.Source = "SELECT Name FROM Shops WHERE Name LIKE '%"+
    shop__MMColParam.replace(/'/g, "''") + "%' ORDER BY Name ASC";
    shop.CursorType = 0;
    shop.CursorLocation = 2;
    shop.LockType = 1;
    shop.Open();
    var shop_numRows = 0;
    %>
    <html>
    <head>
    <title>result</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_reloadPage(init) { //reloads the window if Nav4 resized
    if (init==true) with (navigator) {if
    ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight;
    onresize=MM_reloadPage; }}
    else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
    location.reload();
    }
    MM_reloadPage(true);
    //-->
    </script>
    <link href="testcss.css" rel="stylesheet" type="text/css">
    </head>

    <body>
    </td>
    <td colspan="2" bgcolor="#000066">
    <div align="left"><strong><font color="#FFFFFF"
    size="3" face="Arial, Helvetica, sans-serif"><a href="product_shop_search.asp"
    class="home">Home</a></font></strong></div>
    </td>
    </tr>
    </table>
    <br>
    <table width="75%" border="0" align="center">
    <tr>
    <td><form action="product_shop_details.asp" method="post" name="form"
    id="form">
    <p align="center"><font size="2" face="Arial, Helvetica,
    sans-serif">Your
    results from the products and shops table are as follows..</font>
    </p>
    <p align="center">
    <% if (result.EOF && result.BOF) { %>
    Nothing selected or nothing to show for Products
    <% } // end result.EOF && result.BOF %>
    <select name="select">
    <option value="" <%=(("" ==
    (result.Fields.Item("Product").Value))?"SELECTED": "")%>>Products... </option>
    <%
    while (!result.EOF) {
    %>
    <option value="<%=(result.Fields.Item("Product").Value)%>"
    <%=((result.Fields.Item("Product").Value ==
    (result.Fields.Item("Product").Value))?"SELECTED": "")%>
    ><%=(result.Fields.Item("Product").Value)%></option>
    <%
    result.MoveNext();
    }
    if (result.CursorType > 0) {
    if (!result.BOF) result.MoveFirst();
    } else {
    result.Requery();
    }
    %>
    </select>
    </p>
    <p align="center">
    <% if (shop.EOF && shop.BOF) { %>
    Shops
    <% } // end shop.EOF && shop.BOF %>
    <select name="select2">
    <option value="" <%=(("" ==
    (shop.Fields.Item("Name").Value))?"SELECTED":"")%> >Shops... </option>
    <%
    while (!shop.EOF) {
    %>
    <option value="<%=(shop.Fields.Item("Name").Value)%>"
    <%=((shop.Fields.Item("Name").Value ==
    (shop.Fields.Item("Name").Value))?"SELECTED":"")%>
    ><%=(shop.Fields.Item("Name").Value)%></option>
    <%
    shop.MoveNext();
    }
    if (shop.CursorType > 0) {
    if (!shop.BOF) shop.MoveFirst();
    } else {
    shop.Requery();
    }
    %>
    </select>
    </p>
    <p align="center">
    <input type="submit" name="Submit" value="OK">
    </p>
    </form>
    </td>
    </tr>
    </table>
    </body>
    </html>
    <%
    result.Close();
    %>
    <%
    shop.Close();
    %>


    longsdale Guest

  6. #5

    Default Re: Show if recordset is empty??

    i now this might sound stupid but when you add the SHOW IF feature to the second recordset, do you change the recordset it is being applied to from the drop down box?
    Don Pacino Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139