0

有没有办法为插入查询使用参数?尝试时出现以下错误。

    /// <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);
    }

在此处输入图像描述

4

1 回答 1

5

您缺少一个括号:

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

应该

.Append("INSERT INTO CF.ActiveSurvey(BrandId, SurveyId)")
于 2012-12-06T19:22:03.007 回答