Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Logic Error

    Hi There

    I am developing a small Purchase Order application and have run into a small
    issue

    I have a two tables called PODetails and POHeader which has fields like

    POHeader
    ==========
    PONumber
    DatePlaced etc etc

    PODetails
    =========
    PONumber
    UnitQuantity
    UnitPrice

    I want to display all POHeader records with the total order value

    SQL = " SELECT Sum(PODetails.Amount) AS Expr1 FROM PODetails where PONumber=
    " & rstDBEdit.Fields("PONumber").Value

    Set RS = Server.CreateObject("ADODB.Recordset")
    RS.Open SQL, CONN_STRING

    if RS.EOF or RS.BOF then
    else
    strTt = FormatNumber( RS("Expr1") , 2)
    end if
    response.write "Total order value = " & RS("Expr1") & "<br>"

    The above code generates an error whenever there is a purchase order which
    has no records in the PODetail table.

    I would like to display 0 whenever there are no rows for a particular
    purchase order at present it gives me an error as the SQL above returns
    nothing.

    Can you please help

    Thanks

    Jas


    J P Singh Guest

  2. Similar Questions and Discussions

    1. Logic in form
      Hi, I have a form with a field called 'Serial_No'. This is a 9 digit number that will be in the form NN-NNN-NN. I would like to have a hidden...
    2. Logic
      I need some help. I have 2 loops. One to find a RadioButtonList in datagrid and second in Session("Answ"). I am trying to assing value from...
    3. CMS logic problem
      Hi All Yet again, I know this is a try it yourself, but I just want to get your feedback/comments on this. I'm creating a CMS that will allow...
    4. Possible logic issue
      Hi; What I am trying to do is to read the input file and and pull a 10 byte section of lines 4 - 6 to a variable. I would take these in order...
    5. logic help please
      Hi, I need a sprite to check where its member's position is in a large nested list (which is a combination property and linear list). Here is the...
  3. #2

    Default Re: Logic Error

    Try this:

    if RS.EOF or RS.BOF then
    response.write "Total order value = 0"
    else
    strTt = FormatNumber( RS("Expr1") , 2)
    end if
    response.write "Total order value = " & RS("Expr1") & "<br>"

    Steve G

    "J P Singh" <noemail@asIhatespam> wrote in message
    news:uIWcfW42DHA.2528@TK2MSFTNGP09.phx.gbl...
    > Hi There
    >
    > I am developing a small Purchase Order application and have run into a
    small
    > issue
    >
    > I have a two tables called PODetails and POHeader which has fields like
    >
    > POHeader
    > ==========
    > PONumber
    > DatePlaced etc etc
    >
    > PODetails
    > =========
    > PONumber
    > UnitQuantity
    > UnitPrice
    >
    > I want to display all POHeader records with the total order value
    >
    > SQL = " SELECT Sum(PODetails.Amount) AS Expr1 FROM PODetails where
    PONumber=
    > " & rstDBEdit.Fields("PONumber").Value
    >
    > Set RS = Server.CreateObject("ADODB.Recordset")
    > RS.Open SQL, CONN_STRING
    >
    > if RS.EOF or RS.BOF then
    > else
    > strTt = FormatNumber( RS("Expr1") , 2)
    > end if
    > response.write "Total order value = " & RS("Expr1") & "<br>"
    >
    > The above code generates an error whenever there is a purchase order which
    > has no records in the PODetail table.
    >
    > I would like to display 0 whenever there are no rows for a particular
    > purchase order at present it gives me an error as the SQL above returns
    > nothing.
    >
    > Can you please help
    >
    > Thanks
    >
    > Jas
    >
    >

    Steve G 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