selectステートメントの結果をC#変数に保存しようとしていますが、このエラーが発生します
「指定されたキャストは無効です」
私がそれを実行するとき。解決方法がわかりません。助けてください
SqlConnection con1 = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString);
SqlCommand cmd1 = new SqlCommand("select cast(round(sum(CAST(AvgNumbers AS numeric(12,2))),2) as decimal(12,2)) AS [Average Days] from MainTable ", con1);
cmd1.Connection = con1;
con1.Open();
Int32 result = (Int32)cmd1.ExecuteScalar();
con1.Close();