2
    string var = "";
    SqlConnection con = new SqlConnection(Banco._strCon);
    string sql = "select max(end_id) from endereco";
    SqlCommand cmd = new SqlCommand(sql, con);
    con.Open();
    SqlDataReader dr = cmd.ExecuteReader();
    if (dr.Read())
        var = (dr["max"]).ToString();
    dr.Close();
    con.Close();
    return var;
I need that amount of max, however, I don’t know what to do inside the [""]. If I leave it like this, the following error appears: 
dr["max"] 'dr["max"]' threw an Exception of type 'System.Indexoutofrangeexception' Object {System.Indexoutofrangeexception}
It worked, thank you
– Vitor Herrmann