none
Set the value of a parameter? RRS feed

  • Question

  • I have a basic update command:

            SqlCommand stagingUpdateCommand = catalogConnection.CreateCommand();
            stagingUpdateCommand.CommandText = string.Format(
            "UPDATE [PMDE{0}StagingTable] " +
            "SET @Property = @PropertyValue " +
            "WHERE [VariantId] = @VariantId", result.Action);
            stagingUpdateCommand.Parameters.Add(new SqlParameter("@VariantId", SqlDbType.VarChar, 64));
            stagingUpdateCommand.Parameters.Add(new SqlParameter("@Property", SqlDbType.VarChar, 64));
            stagingUpdateCommand.Parameters.Add(new SqlParameter("@PropertyValue", SqlDbType.VarChar, 64));
    
    

    I woulid like the set the property or column in the table with the name contained in the @Property parameter. I am not sure of the syntax to make the command text so that the name of the column is used. Any ideas? Thank you.

     


    Kevin Burton
    Saturday, July 16, 2011 5:11 AM

Answers

All replies