Rick Ratchford <[email protected]>
wrote: 
> Your code:
> 
> ((:EndMonth - :StartMonth) * 100 + (:EndDay - :StartDay) + 1300) %
> 1300 
> 
> VB:
> 
> (" & lngEndMth - lngStartMth) & ") * 100 + " & ((lngEndDay -
> lngStartDay) + 1300) Mod 1300
> 
> In the VB version, I'm simply doing all the math outside the string
> itself

Not all math: you are doing "*100 + " in SQL. Herein lies the problem.

> and concat it within the string. Just for giggles, I changed
> so the math is done inside the SQL string and changed mod back to %.
> Same results. 
> 
> SELECT Date, Month, Day, Open, High, Low, Close FROM [AUS $, COMP-R
> AN_REV] WHERE ((Month - 8)*100 + (Day - 1) + 1300) % 1300 <= -4 * 100
> + 0 ORDER BY ((Month - 8)*100 + (Day - 1) + 1300) % 1300

This is not equivalent to what I wrote. It lacks "+1300) % 1300) on the right 
hand side. In my statement, both sides of the comparison are always 
non-negative.

> Well, after going through all the above steps explaining what I did to
> convert, it appears that I can SEE what you mean by the above
> statement. 
> 
> Rather than this...
> 
> (" & lngEndMth - lngStartMth & ") * 100 + ((" & lngEndDay -
> lngStartDay & ") + 1300) % 1300 "
> 
> It should have been this...
> 
> ((" & lngEndMth - lngStartMth & ") * 100 + (" & lngEndDay -
> lngStartDay & ") + 1300) % 1300 "

Either that, or 

& ((lngEndMth - lngStartMth) * 100 +  (lngEndDay - lngStartDay) + 1300) Mod 
1300 &

It's OK to do the math on VB side, as long as you actually do the correct math.

Igor Tandetnik


_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to