SQLデータベースの個別の行をカウントする必要があり、その後、結果はInt変数に格納されます
たとえば、tblSales(table) の個別の行 (SalesID) をカウントし、それを NUM(int variable) に格納します。
ティア:)
Public Function ExecuteQuery(ByVal query As String) As DataTable
Try
Dim cn As New SqlConnection(con)
Dim da As New SqlDataAdapter(query, cn)
Dim cb As New SqlCommandBuilder(da)
Dim dt As New DataTable
da.Fill(dt)
Return dt
Catch ex As Exception
MessageBox.Show(ex.Message)
Return Nothing
End Try
End Function
Private Sub btnFinish_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFinish.Click
dim count as string = "select distinct count(SalesID) from tblSales"
ExecuteQuery(count)
dim Num as Integer = Int32.Parse(Val(count))
End Sub