title: Largest value in a column of ms access and display in a text box VB.NET
body: <p>How to find the largest value in a column of a access table. and displayed in a text box. I give 101 as the default value of the column and the table is empty. I try like this.. But its not working. Code is given below</p>
  
  <pre><code>Dim empid As Integer
  empid=101
  TXTEMPID.Text=empid
  getConnect()
      Dim strSQL As String = "SELECT MAX(EMP_ID) FROM EMPLOYEE "
      Dim cmd As OleDb.OleDbCommand
      Dim Reader As OleDb.OleDbDataReader
      cmd = New OleDb.OleDbCommand(strSQL, Conn)
      Try
          Conn.Open()
          Reader = cmd.ExecuteReader()
          If Reader.Read Then
              empid = CInt(Reader("EMP_ID"))
          End If
          MessageBox.Show(empid)
      Catch ex As Exception
          MessageBox.Show(ex.Message)
      Finally
          Conn.Close()
      End Try
      TXTEMPID.Text = empid + 1
  </code></pre>