【发布时间】:2012-10-19 10:05:12
【问题描述】:
我的 .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);
它会更新除描述列之外的所有列!
【问题讨论】:
-
尝试在 [] 中包含字段名称,例如 [MobileNumber] = @MobileNumber
-
我做到了,但它不再起作用了。 :( 还有其他建议吗?
-
@description在更新时有一些价值吗?尝试调试。它是描述列的有效值吗? -
这是程序其他部分的一个错误,它已解决....抱歉耽误您的时间...谢谢您的帮助...
-
@nawfal: 好吧 - 严格来说,一个数据库表有 rows 和 columns,以及内存中的一个对象(例如您的 .NET 对象)是一个记录并且有字段。但是开发人员经常混淆这些术语 - 但我认为人们应该意识到这些差异,准确并在描述内容时使用正确的术语