"列名无效"旧数据库值出错

时间:2013-05-31 18:14:01

标签: mysql asp.net-mvc database

我在我的一张桌子上更改了我的数据库。在我有这个领域之前:

ORDER_AMOUNT

这是一个NUMERIC(5,2)字段。

该字段已重命名为:

ORDER_DETAIL_AMOUNT

但从那以后,每次应用程序尝试从此表中获取某些内容时,都会发生此错误:

Invalid column name 'ORDER_AMOUNT'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlClient.SqlException: Invalid column name 'ORDER_AMOUNT'.

我是MySql的新手,我正在使用Visual Studio 2012,任何人都可以帮助我了解问题是什么以及如何解决这个问题?

1 个答案:

答案 0 :(得分:1)

同样的事情:你在设计中重命名它,所以你必须在你的应用程序中重命名它。

您可能会在某个地方引用["ORDER_AMOUNT"]。现在,应用程序希望在数据库中看到此列。由于它现在被称为["ORDER_DETAIL_AMOUNT"],它将找不到它并且会给你错误。

更改应用中的名称。并且 Voila

相关问题