Update SQL database with using statement and SqlParameters
Stacking the using statements

I am particularly difficult to please with code that has nesting, and I highly prefer to stack the usings when it is possible.

using (SqlConnection connection = ...)
{
    using (SqlCommand command = ...)
    {
        ...
    }
}


versus

using (SqlConnection connection = ...)
using (SqlCommand command = ...)
{
   ...
}


Exception Handling

You should include exception handling into your code, as it will likely throw an exception sooner or later (such as getting disconnected, network issues, etc.)

using (SqlConnection connection = ...)
using (SqlCommand command = ...)
{
    try
    {
        // open the connection, execute, etc
    }
    catch
    {
        // log and handle exception(s)
    }
}


Using Lists not Arrays

It would likely do you more harm than good to be using an array, especially in the context of maintainable code. I would recommend you switch to using Lists, like this:

List&lt;SqlParameter&gt; p = new List&lt;SqlParameter&gt;();
p.Add(new SqlParameter("@type", newType.Text));
p.Add(new SqlParameter("@name", newName.Text));
p.Add(new SqlParameter("@image", newImage.Text));
p.Add(new SqlParameter("@id", id));


This will let you introduce more items into your parameters without having to do deal with the headaches of explicitly indexing.

Note: If you want to keep the same method signature for your GetExample() method, then don't forget to pass the parameters as an array --- you could use ToArray() to accomplish that.



Here it all is together...

string query = "UPDATE [guitarBrands] SET type = @type, name = @name, image = @image WHERE id = @id";

using (SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["brandsConnection"].ToString()))
using (SqlCommand command = new SqlCommand(query, connection)
{
    try
    {
        // open the connection, execute, etc
        List&lt;SqlParameter&gt; p = new List&lt;SqlParameter&gt;();
        p.Add(new SqlParameter("@type", newType.Text));
        p.Add(new SqlParameter("@name", newName.Text));
        p.Add(new SqlParameter("@image", newImage.Text));
        p.Add(new SqlParameter("@id", id));

        connection.Open();
        GetExample(command, p.ToArray());
        command.ExecuteNonQuery();
        command.Parameters.Clear();
    }
    catch
    {
        // log and handle exception(s)
    }
}