Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42215

VS 2010 SQL Statement Help

$
0
0
PHP Code:

        gtcmd.CommandText = ("SELECT Quantity, UnitPrice, Discount FROM [Order Details]"

I want to use the following formula on each row:

(Quantity * UnitPrice)-(Quantity * UnitPrice * Discount)

Then return that value (total) and add each rows value to a grand total, like so:

PHP Code:

        Dim gtreader As OleDbDataReader gtcmd.ExecuteReader
        
While gtreader.Read
            Dim tot 
As Double
            
For As Integer 0 To gtreader.FieldCount 1
                tot 
CDbl(gtreader(i))
                
tot tot tot
            Next
            gtotalTextbox
.Text tot.ToString
        End 
While 

Problem is i dont know how to construct the correct statement.
Please help and thanks in advance.

Viewing all articles
Browse latest Browse all 42215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>