VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,568 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
How do I get a distinct count using the code below:
Command1.CommandText = "SELECT Count(account_no) FROM fphistory " &
"WHERE arr_date <= '12/31/2021'"
Try
Invoke(Sub() Total = Convert.ToInt32(Command1.ExecuteScalar))
Catch SqlExceptionErr As SqlException
MessageBox.Show(SqlExceptionErr.Message)
End Try
Any help would be appreciated.
If you need a count of distinct numbers, then try 'SELECT Count(distinct account_no) FROM ...'.