Petapoco和参数

时间:2012-12-06 19:17:37

标签: c# petapoco

有没有办法为Insert查询使用参数?我尝试时收到以下错误。

    /// <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

1 个答案:

答案 0 :(得分:5)

您缺少一个括号:

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

应该是

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