I need to acquire the sum of the least n number of values from a table
Dim lot As String = "SELECT SUM(x2) AS x3 FROM (SELECT TOP '" & _TextBox2.Text & "' x1 As x2
FROM (
SELECT SharePrice As x1
FROM Shares
WHERE(Company = '" & _TextBox1.Text & "' AND Availability = True)
ORDER BY SharePrice ASC )
)"
I dont have problems witha nything else but the TOP '" & _TextBox2.Text & "' part Does the SELECT TOP really take parameters in?
I can replace the textbox reference with a hard coded integer and it works. But i want to make it run In visual Basic with user input