我收到用户代码“'TBL' 附近的语法不正确”未处理的 SQLException。我还尝试将 [PrioContextDb].[dbo].[RatingListTriangleModels] 替换为仅表名且不带括号。
using (SqlCommand command = new SqlCommand
("delete from [PrioContextDb].[dbo].[RatingListTriangleModels] TBL where ( TBL.To1Id = @MY_ID and TBL.To2Id = @OTHER_ID ) or ( TBL.To2Id = @My_ID and TBL.To3Id = @OTHER_ID ) or ( TBL.To3Id = @My_ID and TBL.To1Id = @OTHER_ID )", cn))
{
//
// Add new SqlParameter to the command.
//
command.Parameters.Add(new SqlParameter("MY_ID", myToid));
command.Parameters.Add(new SqlParameter("OTHER_ID", theirTradeObjectid));
var no = command.ExecuteNonQuery();