当我尝试比较两行时,它显示如下错误:
Input string was not in a correct format.
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.FormatException: Input string was not in a correct format.
我的代码是:
if (i != (dt.Rows.Count - 1))
{
if (Convert.ToDouble(dt.Rows[i][1].ToString()) ==
Convert.ToDouble(dt.Rows[i + 1][1].ToString())) // this is the wrong line
{
for (int j = 0; j < dt.Rows.Count - i; j++)
{
if (Convert.ToDouble(dt.Rows[i][1].ToString()) ==
Convert.ToDouble(dt.Rows[i + j][1].ToString()))
我也尝试将 ToDouble 更改为 ToInt32,但它不起作用。
谁能告诉我,这个错误信息是什么意思?
非常感谢!!!