How Convert system.data.dataRow value to integer
<p>I faced a problem when getting datarow value and convert to integer. The function will retrieve data and count from database through datatable method. I success get the count value and I want to use the value for calculate the employee absence day.</p>

<pre><code> Dim table As New DataTable
 Dim AttendCommand As New MySqlCommand("SELECT COUNT(EmployeeID) AS AttendDay FROM employee.attendance WHERE EmployeeID=@EmployeeID AND month=@month", MysqlConn)
    MysqlConn.Open()
    AttendCommand.Parameters.AddWithValue("@EmployeeID", txtID.Text)
    AttendCommand.Parameters.AddWithValue("@month", Cmonth)
    Dim adapter = New MySqlDataAdapter(AttendCommand)
    adapter.Fill(table)

    If table.Rows.Count &gt; 0 Then

        test = CInt(table.Rows(0).ToString)

    End If
    MysqlConn.Close()
    'count absence day after retrieve
    Dim countTotal As Integer = 0
    Dim total As Integer = 22
    countTotal = total - test
</code></pre>

<p>The result I get from debug is countTotal=0.</p>