Hi,
I can see two problems in your code:
1. As
Wes Aday said,
date
is a reserved word. Put it in the square brackets:
[date]
.
2.
ORDER BY
clause must be after the
WHERE
clause.
So try changing this:
strSQL = "select top 1 receiving from Delivery order by date desc where description=@desc and dosage=@dosage";
with this:
strSQL = "select top 1 receiving from Delivery where description = @desc and dosage = @dosage order by [date] desc";