Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-08-2007, 03:11 PM   PM User | #1
dav_asp
New to the CF scene

 
Join Date: Jan 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
dav_asp is on a distinguished road
error on display

i just added the 2 following sql commands to my coding as i need to get some data from a different database.
but it keeps throwing this error when i try to display the data from this new command:

here's the code i've used to display it
Code:
if objrs6.eof or isNull(objrs6("DisMonth")) = true or objrs6("DisMonth") = "" then
              DisMonth = "0"
              else
              DisMonth = objrs6("DisMonth")
              end if

error '80020009'
Exception occurred.

/Internal Programs/Discount/breakdown_view.asp, line 139


this line points to the sql command i named SnapshotDiscounts( ). It gets the discount value for the 1st 2 suppliers but when it tries to get it for the 3rd the error comes up.
i checked on the net and microsoft are saying it hapens when you point to a text or memo field in the table. but all my fields are set as numbers.

the supplier it points to, 'B83M', doesnt exist in the table so it should just skip that supplier and move onto the next one but isnt working for some reason.

SQL:
Code:
sub GetSuppliers( )
    SET objRs5 = SERVER.createObject( "ADODB.recordSet" )
    
    dim mysql
    
    mysql = mysql + ""
    mysql = mysql + "SELECT Supplier, [net-turnover@"& myNewMonth &"] AS MonthTO "
    mysql = mysql + "FROM usalanalysis "
    mysql = mysql + "WHERE Customer = '"& objrs("Customer") &"' "
    mysql = mysql + "AND [year-number] = '" & myYear & "' "
    mysql = mysql + "ORDER BY Supplier"
        
    'response.write(mysql)
    'response.end
        
    objRs5.OPEN mysql,objConn,1,3
end sub


sub SnapshotDiscounts( )
    SET objRs6 = SERVER.createObject( "ADODB.recordSet" )
    
    dim mysql
    
    mysql = mysql + ""
    mysql = mysql + "SELECT Supplier, [Sett@"& myNewMonth &"] AS DisMonth FROM Settlement_Out "
    mysql = mysql + "WHERE [Year-Number] = "& myYear &" "
    mysql = mysql + "AND Supplier = '"& objrs5("Supplier") &"' "    
    mysql = mysql + "ORDER BY Supplier"
        
    response.write(mysql)
    'response.end

    objRs6.OPEN mysql,objConn3,1,3
end sub
dav_asp is offline   Reply With Quote
Old 06-09-2007, 05:33 AM   PM User | #2
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
In VBScript, all ORed conditions are evaluated even if the first condition is satisfied, unlike in Javascript or other languages. The same way in ANDed conditions, if first condition is not satisfied, the next one is still evaluated. So the solution is to separate the conditions accordingly.

Code:
DisMonth = "0"
if not objrs6.eof and not objrs6.bof then
  if not isNull(objrs6("DisMonth")) and  objrs6("DisMonth") <> "" then
    DisMonth = objrs6("DisMonth")
  end if
end if
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app

Last edited by glenngv; 06-09-2007 at 05:50 AM..
glenngv is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:43 AM.


Advertisement
Log in to turn off these ads.