Ao executar command.Prepare (), tenho o erro “SqlCommand.Prepare method exige que todos os parâmetros tenham um tipo definido explicitamente”

Eu tenho as seguintes declarações:

SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["DataBaseName"]);
SqlCommand cmd = new SqlCommand();
cmd.Connection = con;
cmd.CommandText = "update Table1 set data = @data where id = @id";
cmd.Parameters.AddWithValue("@data", SqlDbType.VarChar).Value =  data;
cmd.Parameters.AddWithValue("@id", SqlDbType.Int).Value =  id;
cmd.CommandType = CommandType.Text;

try
{
    DataSet ds = new DataSet();
    con.Open();
    cmd.Prepare();
    cmd.ExecuteNonQuery();
    return true;
}

Ao executarcmd.Prepare() Tenho um erroSqlCommand.Prepare method requires all parameters to have an explicitly set type

Li algumas respostas aqui, mas parece que fiz como descritoaqui mas ainda tem o mesmo problema.

o que estou perdendo?

questionAnswers(0)

yourAnswerToTheQuestion