At least, you need to pass your SQL command string and SqlConnection
object to SqlCommand
object before you can execute the command :
Dim str As String = "select isnull(max(idcr_record),0)+1 from cr_record where Emplid = '" & Session("Emplid") & "'"
Dim conn As New MySqlConnection
conn.ConnectionString = "....."
'pass your SQL command string and MySqlConnection object to MySqlCommand
'
Dim com As New MySqlCommand(str, conn)
conn.Open()
Dim count As Integer = Convert.ToInt32(com.ExecuteScalar())