我不明白錯誤消息。標量變量是什麼? @ASIN值應該存儲在爲GetByAsin方法創建的id變量中。必須聲明標量變量「@ASIN」
//Gets one Music Detail
public MusicDescriptionModel GetByAsin(string id)
{
using (IDbConnection db = connection)
{
string sql = "select ASIN, Title, Artist, Price, ReleaseDate,NumberDisks,label,DetailPageURL, Review" +
"FROM tblDescription WHERE id = @ASIN";
//need to parameterize ID to avoid sql injection attacks.
MusicDescriptionModel musicdesc = db.Query<MusicDescriptionModel>(sql, new { id }).SingleOrDefault();
return musicdesc;
}
}
如何@ASIN得到您的SQL字符串設定? – Jake
它在id = @ASIN –
@mason擊敗了我。 – Jake