C# 更新查询适用于除一列之外的所有列

C# 更新查询适用于除一列之外的所有列,c#,sql,C#,Sql,我在.xsd文件中有一个更新查询,如下所示: UPDATE Factors SET CodeFactor = @CodeFactor, Date = @Date, MobileNumber = @MobileNumber, Description= @Description, TotalPrice = @TotalPrice, ShouldPayPrice = @ShouldPayPrice WHERE ID = @Original_ID;

我在.xsd文件中有一个更新查询,如下所示:

UPDATE Factors 
SET    CodeFactor = @CodeFactor, Date = @Date, MobileNumber = @MobileNumber, 
       Description= @Description, TotalPrice = @TotalPrice, 
       ShouldPayPrice = @ShouldPayPrice 
       WHERE ID = @Original_ID; 
SELECT   ID, CodeFactor, Date, PersonName, MobileNumber, Description, TotalPrice, 
         ShouldPayPrice, PaidPrice, Settlement, Kind 
FROM     Factors 
WHERE    ID = @Original_ID
ORDER BY Date DESC;
Fact.UpdateQuery(txtShomareFactor.Text.Trim(), fdpDate.Text.Trim(),
                 txtMobile.Text.Trim(), txtSharheKharid.Text,
                 Convert.ToInt64(txtJameKol.Text.Replace(",", "").Trim()),
                 Convert.ToInt64(txtMablagheGhabelePardakht.Text.Replace(",", "").Trim()), 
                 IDFactorTOShowDetails);
我在我的表格中使用它,如下所示:

UPDATE Factors 
SET    CodeFactor = @CodeFactor, Date = @Date, MobileNumber = @MobileNumber, 
       Description= @Description, TotalPrice = @TotalPrice, 
       ShouldPayPrice = @ShouldPayPrice 
       WHERE ID = @Original_ID; 
SELECT   ID, CodeFactor, Date, PersonName, MobileNumber, Description, TotalPrice, 
         ShouldPayPrice, PaidPrice, Settlement, Kind 
FROM     Factors 
WHERE    ID = @Original_ID
ORDER BY Date DESC;
Fact.UpdateQuery(txtShomareFactor.Text.Trim(), fdpDate.Text.Trim(),
                 txtMobile.Text.Trim(), txtSharheKharid.Text,
                 Convert.ToInt64(txtJameKol.Text.Replace(",", "").Trim()),
                 Convert.ToInt64(txtMablagheGhabelePardakht.Text.Replace(",", "").Trim()), 
                 IDFactorTOShowDetails);

它会更新除“说明”列之外的所有列

您应该像[Description]=@Description那样尝试,因为Description word应该是SQL中的一种特殊关键字。

首先尝试检查代码并跟踪它,然后查看SQL Profiler以获取从应用程序发送到SQL的内容。 还要注意,描述是sql server中的关键字。在[]之间使用,或在列名之前使用表名。 类似于
因素。[说明]
总体上更改您的查询,如下所示:

UPDATE Factors 
SET    CodeFactor = @CodeFactor, [Date] = @Date, MobileNumber = @MobileNumber, 
       [Description]= @Description, TotalPrice = @TotalPrice, 
       ShouldPayPrice = @ShouldPayPrice 
       WHERE ID = @Original_ID; 
SELECT   ID, CodeFactor, [Date], PersonName, MobileNumber, [Description], TotalPrice, 
         ShouldPayPrice, PaidPrice, Settlement, Kind 
FROM     Factors 
WHERE    ID = @Original_ID
ORDER BY [Date] DESC;

尝试将字段名包含在[]中,如[MobileNumber]=@MobileNumberI这样做了,但再次无效:(还有其他建议吗?
@description
在更新时有价值吗?请尝试调试。它是description列的有效值吗?这是程序其他部分的错误,已解决了…很抱歉收到您的时间…谢谢您的帮助…@nawfal:严格来说,数据库表有行和列,并且内存中的对象(例如你的.NET对象)是一个记录,有字段。但是开发人员经常混淆这些术语——但我认为人们应该意识到这些差异,在描述内容时要精确并使用正确的术语