0

Is there a way to use parameters for Insert queries? I get the following error when I try.

    /// <summary>
    /// Set active survey
    /// </summary>
    public int SetSurveyActive(int brandId, int surveyId)
    {
        Sql sql = new Sql()
            .Append("INSERT INTO CF.ActiveSurvey(BrandId, SurveyId")
            .Append("VALUES(@0,@1)",brandId,surveyId);

        var result = database.Execute(sql);

        return Convert.ToInt32(result);
    }

enter image description here

chobo
  • 31,561
  • 38
  • 123
  • 191

1 Answers1

5

You are missing a bracket:

.Append("INSERT INTO CF.ActiveSurvey(BrandId, SurveyId")

should be

.Append("INSERT INTO CF.ActiveSurvey(BrandId, SurveyId)")
Blorgbeard
  • 101,031
  • 48
  • 228
  • 272