intermittent type mismatch

Discussion in 'ASP General' started by LJgrnl, Nov 5, 2004.

  1. LJgrnl

    LJgrnl Guest

    I've got a type mismatch error that's driving me nutty. Variable blnNoData
    has the initial value False. If a recordset comes back empty (both .EOF and
    ..BOF are true) then blnNoData is set to True. I then have an if statement to
    determine what to write to the screen depending on blnNoData. As long as the
    if statement is true (doesn't have to go to the else clause), the code runs
    fine. Otherwise, a type mismatch error is returned. In other words, if the
    recordset is empty and I test "If blnNoData", then it's fine, but if the
    recordset is not empty, the type mismatch error happens. If the recordset is
    not empty and I test "If not blnNoData", then it's fine, but if the
    recordset is empty the type mismatch error happens.

    Code below:

    dim sqlEMI, aryEMI, blnNoData
    blnNoData = False

    sqlEMI = "select emiNumber, emiTitle, savingsElectricity,
    costSavingsElectricity, savingsDemand, costSavingsDemand, " &_
    "nonEnergySavings, rebateorGrantAmount, netCostSavings, annualCostSavings,
    simplePayback, recommended " & _
    "from bem_trelDescriptionToEMI de " & _
    "inner join bem_tblEMI e on de.emiid = e.emiid " &_
    "inner join bem_tlkEMICodes ec on e.emitypeid =
    ec.emitypeid " &_
    "inner join bem_tlkBuildingSystem bs on bs.systemid =
    de.systemid " &_
    "where de.teaid = " & session("intTeaID")

    getConn()
    getRS(sqlEMI)
    if adoRS.EOF and adoRS.BOF then
    blnNoData = True
    else
    aryEMI = adoRS.GetRows
    end if
    closeRS()
    closeConn()

    '#######################################################
    'TABLE HEADER
    '#######################################################
    response.write "<div class='smalllandscapereport'><div class=header><p>List
    of EMI Savings & Cost</p></div>" & vbcrlf
    'response.end
    if blnNoData then
    response.write "<p>Unable to retrieve EMI information. This may be
    because you haven't entered any information for this form yet. Please review
    form input and try again.</p>"
    else
    '....(display recordset results)
    end if
     
    LJgrnl, Nov 5, 2004
    #1
    1. Advertising

  2. LJgrnl

    Jeff Dillon Guest

    What line does the type mismatch occur.

    Jeff
    "LJgrnl" <> wrote in message
    news:...
    > I've got a type mismatch error that's driving me nutty. Variable

    blnNoData
    > has the initial value False. If a recordset comes back empty (both .EOF

    and
    > .BOF are true) then blnNoData is set to True. I then have an if statement

    to
    > determine what to write to the screen depending on blnNoData. As long as

    the
    > if statement is true (doesn't have to go to the else clause), the code

    runs
    > fine. Otherwise, a type mismatch error is returned. In other words, if

    the
    > recordset is empty and I test "If blnNoData", then it's fine, but if the
    > recordset is not empty, the type mismatch error happens. If the recordset

    is
    > not empty and I test "If not blnNoData", then it's fine, but if the
    > recordset is empty the type mismatch error happens.
    >
    > Code below:
    >
    > dim sqlEMI, aryEMI, blnNoData
    > blnNoData = False
    >
    > sqlEMI = "select emiNumber, emiTitle, savingsElectricity,
    > costSavingsElectricity, savingsDemand, costSavingsDemand, " &_
    > "nonEnergySavings, rebateorGrantAmount, netCostSavings, annualCostSavings,
    > simplePayback, recommended " & _
    > "from bem_trelDescriptionToEMI de " & _
    > "inner join bem_tblEMI e on de.emiid = e.emiid " &_
    > "inner join bem_tlkEMICodes ec on e.emitypeid =
    > ec.emitypeid " &_
    > "inner join bem_tlkBuildingSystem bs on bs.systemid =
    > de.systemid " &_
    > "where de.teaid = " & session("intTeaID")
    >
    > getConn()
    > getRS(sqlEMI)
    > if adoRS.EOF and adoRS.BOF then
    > blnNoData = True
    > else
    > aryEMI = adoRS.GetRows
    > end if
    > closeRS()
    > closeConn()
    >
    > '#######################################################
    > 'TABLE HEADER
    > '#######################################################
    > response.write "<div class='smalllandscapereport'><div

    class=header><p>List
    > of EMI Savings & Cost</p></div>" & vbcrlf
    > 'response.end
    > if blnNoData then
    > response.write "<p>Unable to retrieve EMI information. This may be
    > because you haven't entered any information for this form yet. Please

    review
    > form input and try again.</p>"
    > else
    > '....(display recordset results)
    > end if
     
    Jeff Dillon, Nov 5, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. data type mismatch error

    , Aug 10, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    639
    Karl Seguin
    Aug 10, 2005
  2. type mismatch error

    , Aug 12, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    3,366
    Kevin Spencer
    Aug 12, 2005
  3. Artie Gold

    Re: type mismatch

    Artie Gold, Feb 28, 2004, in forum: C Programming
    Replies:
    0
    Views:
    398
    Artie Gold
    Feb 28, 2004
  4. Harry Pehkonen

    win32com, string array --> Type mismatch?

    Harry Pehkonen, Aug 8, 2003, in forum: Python
    Replies:
    2
    Views:
    1,874
    Harry Pehkonen
    Aug 11, 2003
  5. programmingzeal
    Replies:
    0
    Views:
    1,127
    programmingzeal
    May 6, 2012
Loading...

Share This Page