below is my code. i want to get grand total based on boothID but i seems my code does not functioning. I still get same GRANDTOTAL even i have different BoothId in the sql. How do i do that. Do i need to add something in my code. PLEASE GUIDE ME!!!
Public Function CreditBalance() As Double Dim myConnection As SqlConnection Dim myCommand As SqlCommand Dim icount As Integer Dim strSQL As String = "" Dim connStr As String Dim dr As SqlDataReader myConnection = GetConnect("REMOTE") myConnection.Open() strSQL = "SELECT TOP 1 [GrandTotal],[BoothID] FROM RetailerBalance ORDER BY TransactionDate DESC" myCommand = New SqlCommand(strSQL, myConnection) dr = myCommand.ExecuteReader While dr.Read If Not dr.IsDBNull(0) Then CreditBalance = dr(0) End If End While myConnection.Close() End Function