我正在尝试将 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();