且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在C#中更新两个Joned SQL表中的一个

更新时间:2023-02-14 15:39:27

嗯...看看你的更新命令。

我会削减它到了基础,所以你可以更清楚地看到它在做什么:

Well...look at your update command.
I'll pare it down to the basics so you can see more clearly what it is doing:
UPDATE Bought SET Stockid = Stockid, BuyDate = BuyDate , ...



这意味着将字段的值设置为当前价值。

实际上,它实际上是在扔掉一个特殊的,而不是执行,因为你忘了经纪中的最后一个e:


Which means "Set the value of the field to it's current value".
The chances are that it's actually throwing an exceptiopn rather than executing at all, since you forgot the final "e" in "Brokerage":

.Price, Bought.Brokerage = Bought.Brokerag, Bought.

因此,除非有两个名称非常相似的列,否则SQL不会高兴。



我无法建议您需要做什么 - 我不知道您要在CurrencyManager中存储要保存的信息的位置(我假设这个是你的应用程序的名称?) - 但你需要更仔细地思考你想要做什么:甚至修复,SQL不会做任何有用的事情。

So unless there are two columns with very similar names SQL is not going to be happy.

I can't suggest what you need to do - I don't know where you are storing the info you want to save in "CurrencyManager" (I assume this is the name of your app?) - but you do need to think a little more carefully about what you are trying to do: even fixed, that SQL isn't going to do anything useful.