Checking for Empty ResultSet

I am doing an insert into a table, but only if the first name and last name are not already in the table...
i tried using the wasNull() method but that didn't work,
Here's the code, I'm sure you'll be able to get the jist of it when you see it...
            Statement SQLStat = ourSiteConn.createStatement();
            String SQL = "SELECT * FROM tblCustomer WHERE FName = '"+FName+"' AND LName = '"+LName+"'";
            rs_CustomerCheck = SQLStat.executeQuery(SQL);
            while (rs_CustomerCheck.next())
                FNameChk = rs_CustomerCheck.getString(2);
                LNameChk = rs_CustomerCheck.getString(3);
            if (rs_CustomerCheck.wasNull())
                 //Code for this condition here
            else
                //Code for this condition here
            }What i'm trying todo is search my DB for the name that the user enters, if it doens't find anything in the DB it should return true right? which would make that work..i think...
Any idea's would be Much appreciated
~Jon

After you do your query, you want to find out if it returned zero records. If it did, then trying to get the fields from the records is pointless (at least in your current design). So just check to see if you can read the first record, and if you can't then there weren't any records...
String SQL = "SELECT * FROM tblCustomer WHERE Name = '"+FName+"' AND LName = '"+LName+"'";
rs_CustomerCheck = SQLStat.executeQuery(SQL);
if (! rs_CustomerCheck.next()) {
// query found no records

Similar Messages

  • Check for empty visa resource?

    When I am developing the VI at my desk and not a the test station PC, the VISA resource name is empty.
    Once the VI is moved to the test station PC, the user can select a VXI board.
    How do I make sure the user has selected a VISA resource before continuing?
    I can wire a Comparision to check for Empty String, and that works. But is there any method that I should use?
    Solved!
    Go to Solution.

    Additionally, you can limit the selectable items by interface type. Right-click VISA Resource Name Control and select I/O Name Filtering.
    National Instruments
    Product Support Engineer

  • Check for empty session variable

    Hey there we're making a login for our jsp web application.
    The login allready works and so does the log out but now we want to make a check to make it impossible to login with names that are not in the database.
    So what basicly happens is as follows...
    Login reads the database info:
    while (rs.next()) {
         if (request.getParameter("username").equals(rs.getString("username")) && request.getParameter("password").equals(rs.getString("password"))){
              session.setAttribute("username", rs.getString("username"));
              session.setAttribute("firstname", rs.getString("first_name"));
              session.setAttribute("lastname", rs.getString("last_name"));
    }but when you enter invalid information teh session variabe "lastname" for example should read null. Now we want to make a check for this null value, which should look something like this:
    if(session.getAttribute("username").equals(null)){
         response.setStatus(301);
         response.setHeader("Location", "/index.jsp");
    } else {
         response.setStatus(301);
         response.setHeader("Location", "/mainmenu.jsp");
    }But this doesnt work, it just logs in with the null values... any1 got a clue??
    edit: im actually looking for something like the isSet command in PHP to give an idea...
    Message was edited by:
    whappit

    Your test for null will always fail, because request.getParameter("username") is NEVER null, in that it exists, even though it contains no data.
    Try .equals(""); instead.

  • Check for empty table row before adding date

    On the form below, when I click the green + button (far right), a new table row is created with today's date. the user can then enter more text to the right of the date. Problem is when the form is saved and reopened, the text the user enters is deleted and new today's date added because it is in the intialize event. How do I script to check and make sure each dated row is empty before adding today's date?
    https://acrobat.com/#d=qTINfyoXA-U6cDxOGgcSEw
    Thanks,
    ~Don

    Hi Don,
    One option would be to use the caption area of the textfield for the date and leave the value portion free for the user to input their data:
    if (xfa.resolveNode("this.caption.value.#text").value === "") {
              this.caption.value.text = util.printd("[mm/dd/yy] ", new Date() );
    See here: https://acrobat.com/#d=VjJ-YsXLKmV6QU84JrAAIw.
    Hope that helps,
    Niall

  • PL SQL block - Check for empty file

    Hello,
    I need help in writing pl sql code to check a file to verify if it has 0 records (file size = zero kb.) In a preceding pl sql block, I am performing a SELECT on data and writing it to a file. If that file is empty/has no records, then I would like to stop the process from continuing on to my next pl sql block which performs an update function.
    Summary:
    1) Create file from SELECT
    2) Check file for zero data, if true, trigger error, if false, continue to next pl sql block.
    3) Run update on records if data exists in the file.
    Thanks in advance!

    Thanks John,
    You've been of great help so far and a really appreciate it. I'm so close to getting this, I just need help with how to create an error when the file shows no data. I will be running this as an Oracle Apps Concurrent request. I'd like for the job to end in error when no data exists for the file. In unix, I can enter "EXIT 1" and it signals to the concurrent manager to put end the job with an error status. How can I do something similar using pl sql? Here is my code so far, with the missing piece. Thanks!
    DECLARE
      vFile UTL_FILE.FILE_TYPE;
      vrecs BOOLEAN := FALSE;
      vnodata EXCEPTION;
    BEGIN
      vFile := UTL_FILE.FOPEN('/devlop, 'norecs.txt', 'w', 32767);
    FOR x IN (
    SELECT
         node_name AS txt
    FROM
         applsys.fnd_nodes
    WHERE
         node_name = 'blahblahblah'
    LOOP
            vrecs := TRUE;
            UTL_FILE.PUT_LINE (vFile, x.txt);
    END LOOP;
            UTL_FILE.FCLOSE(vFile);
            IF NOT vrecs THEN
                RAISE vnodata;
            END IF;     
    EXCEPTION
           WHEN vnodata THEN
        *<what can I put here to cause the pl sql block to error???>*
    END;
    /

  • Checking for empty tags using expression builder for XPATH

    I am creating several filters in a mediator for several parallel paths. I am trying to route the mediator to the correct DB adapter based on what tags are empty in the incoming XML. The XML has 1 required tag and 3 optional. So for the expression, I am using the expression builder to load the tag name then putting either [text()] or [not(text())] immediately after each tag with an "and" in between for the 3 optional elements. The problem I am having is they always return false. For example, if I enter a value for an optional tag and put [text()] after it, it evaluates to false. What is the correct way to check if an element has text or not?
    Thanks in advance!

    Hi,
    Its not recognizing the getVariableData func... instead try this:
    string-length(xpath)>0
    ex: string-length($in.body/imp1:manoj/imp1:C1)>0
    It works... Happy deploying ... :)

  • Need help understanding whats wrong with ASP checking for empty fields.

    Can anyone tell me whats wrong with these if statements: If i
    sumbit the
    form providing everything except the dream_inscript field it
    gives me this
    error:
    =================================================
    Microsoft OLE DB Provider for ODBC Drivers error '80040e57'
    [Microsoft][ODBC Microsoft Access Driver]Invalid string or
    buffer length
    /purch_confirm_mail.asp, line 67
    =================================================
    If i submit the form and provide just that field along with
    the first 4
    which are automatically passed from the DB the form submits
    fine and no
    problem.. I know it has something to do with my If
    Statements..
    Basically i want to check the 4 fields:
    dream_inscript If this one is -1 then pass N/A to the db
    dream_price If dream_inscript <> -1 then pass 45 to the
    db
    dream_comm if dream_comm is empty then pass N/A to the db
    custom_inscript if custom_inscript is empty then pass N/A to
    the db
    custom_wanted if this is Y then pass 45 to the db
    custom_comm if this is empty then pass N/A to the db
    MM_editCmd.CommandText = "INSERT INTO tbMailOrders
    (item_number,
    item_summary, item_price, shipping_cost, dream_price,
    dream_inscript,
    dream_comm, custom_comm, custom_price, video_wanted,
    video_price,
    grandtotal, cs_name, pp_email, c_email) VALUES (?, ?, ?, ?,
    MM_editCmd.Prepared = true
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param1", 202,
    1, 10, Request.Form("item_number")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param2", 202,
    1, 255, Request.Form("item_summary")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param3", 202,
    1, 10, Request.Form("itemprice")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param4", 202,
    1, 10, Request.Form("shippingcost")) ' adVarWChar
    If cStr(Request.Form("dream_inscript"))<> "-1" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param5", 202, 1,
    10, "45") ' adVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param5", 202,
    1, 10, "0.00") ' adVarWChar
    End If
    If cStr(Request.Form("dream_inscript"))<> "-1" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param6", 203, 1,
    1073741823, Request.Form("dream_inscript")) ' adLongVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param6", 203,
    1, 1073741823, "N/A") ' adLongVarWChar
    End If
    If Len(cStr(Request.Form("dream_comm")))= "0" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param7", 203,
    1, 1073741823, "N/A") ' adLongVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param7", 203,
    1, 1073741823, Request.Form("dream_comm")) ' adLongVarWChar
    End If
    If Len(cStr(Request.Form("custom_inscript")))= "0" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param8", 203,
    1, 1073741823, "N/A") ' adLongVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param8", 203, 1,
    1073741823, Request.Form("custom_inscript")) ' adLongVarWChar
    End If
    If Request.Form("custom_wanted")= "Y" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param9", 202,
    1, 10, "45") ' adVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param9", 202,
    1, 10, "0.00") ' adVarWChar
    End If
    If Request.Form("video_wanted")= "Y" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param10", 202,
    1, 10, "Yes") ' adVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param10", 202,
    1, 10, "No") ' adVarWChar
    End If
    If Request.Form("video_wanted")= "Y" Then
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param11", 202, 1,
    10, "15") ' adVarWChar
    Else
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param11", 202,
    1, 10, 0.00) ' adVarWChar
    End If
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param12", 202,
    1, 10, Request.Form("grand")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param13", 202,
    1, 255, Request.Form("name")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param14", 202,
    1, 255, Request.Form("email")) ' adVarWChar
    MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param15", 202,
    1, 255, Request.Form("email2")) ' adVarWChar
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close
    ASP, SQL2005, DW8 VBScript, Access

    issue corrected.
    ASP, SQL2005, DW8 VBScript, Visual Studio 2005, Visual Studio
    2008
    "Daniel" <[email protected]> wrote in message
    news:[email protected]...
    > Can anyone tell me whats wrong with these if statements:
    If i sumbit the
    > form providing everything except the dream_inscript
    field it gives me this
    > error:
    > =================================================
    > Microsoft OLE DB Provider for ODBC Drivers error
    '80040e57'
    > [Microsoft][ODBC Microsoft Access Driver]Invalid string
    or buffer length
    >
    > /purch_confirm_mail.asp, line 67
    > =================================================
    > If i submit the form and provide just that field along
    with the first 4
    > which are automatically passed from the DB the form
    submits fine and no
    > problem.. I know it has something to do with my If
    Statements..
    >
    > Basically i want to check the 4 fields:
    >
    > dream_inscript If this one is -1 then pass N/A to the db
    > dream_price If dream_inscript <> -1 then pass 45
    to the db
    > dream_comm if dream_comm is empty then pass N/A to the
    db
    >
    > custom_inscript if custom_inscript is empty then pass
    N/A to the db
    > custom_wanted if this is Y then pass 45 to the db
    > custom_comm if this is empty then pass N/A to the db
    >
    >
    >
    >
    > MM_editCmd.CommandText = "INSERT INTO tbMailOrders
    (item_number,
    > item_summary, item_price, shipping_cost, dream_price,
    dream_inscript,
    > dream_comm, custom_comm, custom_price, video_wanted,
    video_price,
    > grandtotal, cs_name, pp_email, c_email) VALUES (?, ?, ?,
    > ?, ?, ?, ?, ?, ?)"
    > MM_editCmd.Prepared = true
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param1", 202,
    > 1, 10, Request.Form("item_number")) ' adVarWChar
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param2", 202,
    > 1, 255, Request.Form("item_summary")) ' adVarWChar
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param3", 202,
    > 1, 10, Request.Form("itemprice")) ' adVarWChar
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param4", 202,
    > 1, 10, Request.Form("shippingcost")) ' adVarWChar
    > If cStr(Request.Form("dream_inscript"))<> "-1"
    Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param5", 202, 1,
    > 10, "45") ' adVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param5", 202,
    > 1, 10, "0.00") ' adVarWChar
    > End If
    > If cStr(Request.Form("dream_inscript"))<> "-1"
    Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param6", 203, 1,
    > 1073741823, Request.Form("dream_inscript")) '
    adLongVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param6", 203,
    > 1, 1073741823, "N/A") ' adLongVarWChar
    > End If
    > If Len(cStr(Request.Form("dream_comm")))= "0" Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param7", 203,
    > 1, 1073741823, "N/A") ' adLongVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param7", 203,
    > 1, 1073741823, Request.Form("dream_comm")) '
    adLongVarWChar
    > End If
    > If Len(cStr(Request.Form("custom_inscript")))= "0" Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param8", 203,
    > 1, 1073741823, "N/A") ' adLongVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param8", 203, 1,
    > 1073741823, Request.Form("custom_inscript")) '
    adLongVarWChar
    > End If
    > If Request.Form("custom_wanted")= "Y" Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param9", 202,
    > 1, 10, "45") ' adVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param9", 202,
    > 1, 10, "0.00") ' adVarWChar
    > End If
    > If Request.Form("video_wanted")= "Y" Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param10", 202,
    > 1, 10, "Yes") ' adVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param10", 202,
    > 1, 10, "No") ' adVarWChar
    > End If
    > If Request.Form("video_wanted")= "Y" Then
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param11", 202, 1,
    > 10, "15") ' adVarWChar
    > Else
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param11", 202,
    > 1, 10, 0.00) ' adVarWChar
    > End If
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param12", 202,
    > 1, 10, Request.Form("grand")) ' adVarWChar
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param13", 202,
    > 1, 255, Request.Form("name")) ' adVarWChar
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param14", 202,
    > 1, 255, Request.Form("email")) ' adVarWChar
    > MM_editCmd.Parameters.Append
    MM_editCmd.CreateParameter("param15", 202,
    > 1, 255, Request.Form("email2")) ' adVarWChar
    > MM_editCmd.Execute
    > MM_editCmd.ActiveConnection.Close
    >
    > --
    > ************************************************
    > ASP, SQL2005, DW8 VBScript, Access
    >

  • Check for empty cell in report

    I have a report that displays true or false in the rows for a number of automobile models that are the columns.
    I have the case statement below setup in the column formula section of one of my columns.  It does kind of work, but if "FT_AUTOS"."productionEnded" is nothing(i.e. returns nothing, not even NULL), then it will just show a blank cell.  Is there a way to include "empty" so that it also shows up as incomplete?
    case
        when SUM(case when "FT_AUTOS"."productionEnded" IS NOT NULL then 1  else 0 end) > 0 
        then '<div title= "True"  style="background:#00ff00;text-align:center">'||'True'||'</div>' 
        else  '<div title= "False"  style="background:#ff0000;text-align:center">'||'False'||'</div>' 
    end
    Thanks

    length("FT_AUTOS"."productionEnded")
    might tell you about NULL or '' or ' ' etc
    forget about your report for a while and just pull this column with above expression and then run it, sort it asc
    then look values and then sort to desc

  • Check For Null ResultSet

    i need to do an if statement that if the resultset is not null do condition1 and if it is null...do condition 2...
    does anyone know how todo this?

    there is a next() method in ResultSet ..
    you do it like this
    //rs is your ResultSet
    if (rs.next())//or if you expect more than 1 then you do while (rs.next())
         //you get the values here
         //if the first value is String
         String s = rs.getString(1);
         //if it's a integer
         int s2 = rs.getint(1);
    }

  • Workflow: check multiline container element for emptiness

    Hi!
    Please suggest how to check multiline workflow-container element for emptiness in condition block.
    Regards,
    Maxim.

    Hi Max,
    One way to do this is to add a process step which calls a function module passing the multiline container as the import parameter. In this function mod, you can check for emptiness and set a variable which will be the export parameter. Map this export parameter of the step to a workflow container field. Finally in the next step (control block) you can check the above workflow field.

  • Advanced search for a price range while checking for an empty values using php in DW

    I am creating an advanced search with DW php. I would like to submit a search where some entrys can be left black. So checking for empty values (which I have managed, thank you David Powel), however when searching between multiple price ranges does not seem to work.
    please see attached forms:
    The search page:
    <form action="Detailed-Search-Result.php" method="get" target="_self"><table width="90%" border="0" cellspacing="0" cellpadding="2">
      <tr>
        <td colspan="2"><label for="Detailed Search">Advanced Search</label></td>
        </tr><tr>
        <td><label for="Product">Product:</label>
          </td>
        <td><select name="Category" id="Category">
          <option value=></option>
            <option value="Keyboard">Keyboard</option>
            <option value="Piano">Piano</option>
          </select></td>
      </tr>
      <tr>
        <td><label for="Make">Make:</label>
        </td>
        <td><select name="Manufacturer">
          <option value=></option>
          <option value="Boss">Boss</option>
          <option value="Casio">Casio</option>
          <option value="Kawai">Kawai</option>
          <option value="Ketron">Ketron</option>
          <option value="Korg">Korg</option>
          <option value="Roland">Roland</option>
          <option value="Samson">Samson</option>
          <option value="Yamaha">Yamaha</option>
        </select></td>
      </tr>
      <tr>
        <td><label for="Color">Color:</label></td>
        <td><select name="Color">
          <option value=></option>
          <option value="Black">Black</option>
          <option value="Cherry">Cherry</option>
          <option value="Mahogany">Mahogany</option>
          <option value="Polished Eboney">Polished Eboney</option>
          <option value="Rosewood">Rosewood</option>
          <option value="White">White</option>
          <option value="Red">Red</option>
        </select></td>
      </tr>
      <tr>
        <td><label for="Price">Price:</label></td>
        <td><select name="Price">
          <option value=></option>
          <option value="0-500">£0-500</option>
          <option value="500-1000">£500-1000</option>
          <option value="1000-2000">£1000-2000</option>
          <option value="2000">£2000&gt;</option>
        </select></td>
      </tr>
      <tr>
        <td colspan="2">
          <input name="Search2" type="submit" id="Search2"></td>
        </tr>
        </table>
    </form>
    The results page
    $varCategory_rsgetsearch2 = "%";
    if (isset($_GET['Category'])) {
      $varCategory_rsgetsearch2 = $_GET['Category'];
    $varMake_rsgetsearch2 = "%";
    if (isset($_GET['Manufacturer'])) {
      $varMake_rsgetsearch2 = $_GET['Manufacturer'];
    $varColor_rsgetsearch2 = "%";
    if (isset($_GET['Color'])) {
      $varColor_rsgetsearch2 = $_GET['Color'];
    $varPrice_rsgetsearch2 = "%";
    if (isset($_GET['Price'])) {
      $varPrice_rsgetsearch2 = $_GET['Price'];
    mysql_select_db($database_dBconn, $dBconn);
    $query_rsgetsearch2 = 'SELECT * FROM products';
    $where = false;
    if (isset($_GET['Category']) && !empty($_GET['Category'])) {
    $query_rsgetsearch2 .= ' WHERE Category LIKE varCategory '. GetSQLValueString($_GET['Category'], 'text');
      $where = true;
    if (isset($_GET['Manufacturer']) && !empty($_GET['Manufacturer'])) {
      if ($where) {
       $query_rsgetsearch2 .= ' AND ';
      } else {
       $query_rsgetsearch2 .= ' WHERE ';
        $where = true;
    $query_rsgetsearch2 .= 'Manufacturer LIKE varManufacturer ' . GetSQLValueString($_GET['Manufacturer'], 'text');
    if (isset($_GET['Color']) && !empty($_GET['Color'])) {
        if ($where) {
       $query_rsgetsearch2 .= ' AND ';
      } else {
       $query_rsgetsearch2 .= ' WHERE ';
        $where = true;
      $query_rsgetsearch2 .= 'Color LIKE varColor ' . GetSQLValueString($_GET['Color'], 'text');
    if (isset($_GET['Price']) && !empty($_GET['Price'])) {
        if ($where) {
       $query_rsgetsearch2 .= ' AND ';
      } else {
       $query_rsgetsearch2 .= ' WHERE ';
        $where = true;
    switch( $_GET['Price'] ){
            case '0-500':
            $query_rsgetsearch2 .= '  RRP BETWEEN 0 AND 500 ORDER BY price ASC'. GetSQLValueString($_GET['Price'], 'text');
            break;
              case '500-1000':
            $query_rsgetsearch2 .= ' RRP BETWEEN 500 AND 1000 ORDER BY price ASC'. GetSQLValueString($_GET['Price'], 'text');
            break;
                        case '1000-2000':
            $query_rsgetsearch2 .= ' RRP BETWEEN 1000 AND 2000 ORDER BY price ASC'. GetSQLValueString($_GET['Price'], 'text');
            break;
              case '2000':
           $query_rsgetsearch2 .= ' RRP BETWEEN 2000 AND 10000 ORDER BY price ASC'. GetSQLValueString($_GET['Price'], 'text');
            break;
    $query_rsgetsearch2 = sprintf("SELECT * FROM products WHERE Category LIKE %s AND products.Manufacturer LIKE %s AND products.Color LIKE %s", GetSQLValueString("%" . $varCategory_rsgetsearch2 . "%", "text"),GetSQLValueString("%" . $varMake_rsgetsearch2 . "%", "text"),GetSQLValueString("%" . $varColor_rsgetsearch2 . "%", "text"));
    $query_limit_rsgetsearch2 = sprintf("%s LIMIT %d, %d", $query_rsgetsearch2, $startRow_rsgetsearch2, $maxRows_rsgetsearch2);
    $rsgetsearch2 = mysql_query($query_limit_rsgetsearch2, $dBconn) or die(mysql_error());
    $row_rsgetsearch2 = mysql_fetch_assoc($rsgetsearch2);
    I would be greatfull for any help

    I have managed to solve the problem.
    In the end I didn't check if the values were empty, as it worked fine without. However the switch of the price didn't work in combination with the rest of the query.
    I've solved the problem as follows:
    $varCategory_rsgetsearch2 = "%";
    if (isset($_GET['Category'])) {
      $varCategory_rsgetsearch2 = $_GET['Category'];
    $varMake_rsgetsearch2 = "%";
    if (isset($_GET['Manufacturer'])) {
      $varMake_rsgetsearch2 = $_GET['Manufacturer'];
    $varColor_rsgetsearch2 = "%";
    if (isset($_GET['Color'])) {
      $varColor_rsgetsearch2 = $_GET['Color'];
    $varPrice_rsgetsearch2 = "%";
    if (isset($_GET['Keysound_price'])) {
      $varPrice_rsgetsearch2 = $_GET['price'];
    mysql_select_db($database_dBconn, $dBconn);
    $query_rsgetsearch2 = sprintf("SELECT * FROM products WHERE Category LIKE %s AND products.Manufacturer LIKE %s AND products.Color LIKE %s", GetSQLValueString("%" . $varCategory_rsgetsearch2 . "%", "text"),GetSQLValueString("%" . $varMake_rsgetsearch2 . "%", "text"),GetSQLValueString("%" . $varColor_rsgetsearch2 . "%", "text") );
    switch( $_GET['price'] ){
            case '0-500':
            $query_rsgetsearch2 .= ' AND price BETWEEN 0 AND 500 ORDER BY price ASC';
            break;
              case '500-1000':
            $query_rsgetsearch2 .= ' AND price BETWEEN 500 AND 1000 ORDER BYprice ASC';
            break;
                        case '1000-2000':
            $query_rsgetsearch2 .= ' AND price BETWEEN 1000 AND 2000 ORDER BY price ASC';
            break;
              case '2000':
            $query_rsgetsearch2 .= ' AND price BETWEEN 2000 AND 10000 ORDER BY price ASC';
            break;
    $query_limit_rsgetsearch2 = sprintf("%s LIMIT %d, %d", $query_rsgetsearch2, $startRow_rsgetsearch2, $maxRows_rsgetsearch2);
    $rsgetsearch2 = mysql_query($query_limit_rsgetsearch2, $dBconn) or die(mysql_error());
    $row_rsgetsearch2 = mysql_fetch_assoc($rsgetsearch2);
    I'm sure that you can keep the checking for values in, however for me the was no need for it anymore.
    Thanks for all your help

  • Check for required fields before locking subforms and submitting

    Hello,
    I have a 5-page form with many questions, to be completed by the original requestor and multiple approvers.  What I'm trying to do is have the original requestor's Submit button on p. 3 lock the input on the first three pages, but first check if all those fields have some content.  I currently have all the fields on pp. 1-3 set to "Required" in the object properties, but my script still locks them when there's is one empty one.  Here's what I have:
    //Lock portions of form
    Page1.access = "readOnly"
    Page2.access = "readOnly"
    Page3.access = "readOnly"
    //Save document, allow user to change name
    app.execMenuItem("SaveAs");
    //Submit via e-mail
    Submit_REAL.event__click.submit.target = "mailto:[email protected]" +
    "?subject=Subject text" +
    "&body=Message";
    Submit_REAL.execEvent("click");
    The automatic check for required fields happens after the pages get locked.  I would like the check to stop the process before it locks the pages.  Is there any way to check all at once that all "Required" fields on those pages have some content before allowing the script to proceed?  I know how to script it to manually check the 50 or so questions on those pages, but I would like to avoid that.  Thanks for any help.

    There are a few problems that I can see from the start. First, your code is going to pick up EVERY node that exists on these pages. Some of those nodes will not have a rawValue, and some will not have an actual name. As an example, you can take your code and create a text field to dump all of the names of the nodes that you get when you pull in all of the nodes this way. Here's an example:
    The result:
    Now, the question is, do you have a consistent naming convention for your fields that might be empty? That could be text fields, radio button lists, etc. For instance, I always prefix the names of objects in order to more easily keep track of what they are in scripts. Since I'm doing that, I can check the name of the field for tf, nf, rbl, cb, or whatever I have included to make sure that I'm checking an actual field before I check for things like rawValue.
    var nodeName = oNodes.item(nNodeCount).name;
    if (nodeName.indexOf("tf")>-1 || nodeName.indexOf("rbl") > -1 || /*check other field types*/) {
      //insert your code to check for empty answers here
    As for your line 7 issue. The syntax problem is that you've put extra parentheses in your if statement. Take out the parentheses that are just before and after the or "||".
    *This is my fourth attempt to reply. Something was going on with Adobe/Jive earlier, I suppose.

  • How can we check whether a ResultSet is EMPTY or NOT ?

    i'm getting some data inside ResulSet (using JDBC inside Servlet).
    now i want to redirect response according to ResultSet...., if ResultSet is EMPTY then on diff page, else on different page...
    how can i check whether a ResultSet is empty or not...
    i've used next() , wasNull() methods ,,, but not solving the purpose...
    thanx in advance...

    What you could do is to ask the database fora
    record count and check that for zero.
    How?????You just do an SQL statement but instead of the list of fields after SELECT you put
    SELECT count(*) FROM ...... WHERE .....
    That returns a single integer value into the resultset giving the number of matching records currently in the database.
    The trouble is you can't be certain that when you subsequently access the records the number won't have changed, because databases are generally accessible to more than one process at a time and some other process might add or delete a record between counting and retrieving or, for that matter, during the process of retrieval.
    Also the count is likely to take more time than just doing rs.next() and seeing if you get a record.
    Since you seem to be in a servlet environment you should consider doing the database query and the first rs.next() at the top of the servlet/JSP that presents the results and, if there are no records, using getServletContext.getRequestDispatcher(...).forward(request, response) to swich to your error page if it returns false.
    So the stucture looks like:
    rs = stmt.executeQuery(......);
    if(!rs.next())
          getServletContext().getRequestDispatcher("/noresultspage.jsp").forward(request, response);
    else {
         do   {
             .... display result data
          } while(rs.next());
        }

  • Check for null and empty - Arraylist

    Hello all,
    Can anyone tell me the best procedure to check for null and empty for an arraylist in a jsp using JSTL. I'm trying something like this;
    <c:if test="${!empty sampleList}">
    </c:if>
    Help is greatly appreciated.
    Thanks,
    Greeshma...

    A null check might not be you best option.  If your requirement is you must have both the date and time component supplied in order to populate EventDate, then I would use a Script Functoid that takes data and time as parameters.
    In the C# method, first check if either is an empty string, if so return an empty string.
    If not, TryParse the data, if successful, return a valid data string for EventDate.  If not, error or return empty string, whichever satsifies the requirement.

  • Check for null or empty in the functoid

    I want to check for null and empty values on input source node. If there exists a null or empty in the input source node, I should not pass that to output destination node. Does the
    following attachment work? I want to check for null or empty in the date and time and then concatenate them to send to output. If any of them is null or empty, the other should not fail. In the Not Equal Functoid I am checking for blank, but how to check for
    null?

    A null check might not be you best option.  If your requirement is you must have both the date and time component supplied in order to populate EventDate, then I would use a Script Functoid that takes data and time as parameters.
    In the C# method, first check if either is an empty string, if so return an empty string.
    If not, TryParse the data, if successful, return a valid data string for EventDate.  If not, error or return empty string, whichever satsifies the requirement.

Maybe you are looking for