i have a problem generating auto number. can someone help me to solve this?

here is my code

Try
            If IsConnected() = True Then
                strSQL = "Select max(*) from Supplier"

            End If
            myCmd.CommandText = strSQL
            myCmd.Connection = myConn
            myDA.SelectCommand = myCmd
            myDR = myCmd.ExecuteReader()


            If myDR.HasRows Then
                Label5.Text = myDR.Item(0)
            Else
                Label5.Text = myDR.Item(0) + 1
            End If



        Catch ex As Exception

        End Try
    End Sub

my label5.text nothing show.

ryan311,
Some more information please. I hope you are using MSAccess as Database. If so then see my attached help. In my attached help see GetNextUserID function in frmUserManagement form.
Hope this helps
Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.