An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
Unlike in VB you need to use parenthesis to call a method (e.g. cnx.CreateCommand should be cnx.CreateCommand()), like this:
using (SqlCommand cmd = cnx.CreateCommand())
{
// ...
}
object objeto = Agregar.ExecuteScalar();
Also you're creating two SqlCommand instances (cmd and Agregar) but you're only using one of them (Agregar) so you could get rid of cmd all together.