我将MyMiddlePart的值复制到NumberOfMonths时出错 错误是InvalidCastException
string readMiddlePartSQL = "select distinct add_months(to_date('" +
My_StartDate.ToString("dd/MM/yyyy") +
"','dd/mm/yyyy'), 1) - add_months(to_date('" +
My_EndDate.ToString("dd / MM / yyyy") +
"','dd / mm / yyyy'),-1)
from UNPAID_LEAVES_REQUEST";
OrderedDictionary MyMiddlePart = ew_ExecuteRow(readMiddlePartSQL);
float NumberOfMonths = Convert.ToSingle(MyMiddlePart);
答案 0 :(得分:2)
My_EndDate.ToString(" dd / MM / yyyy")
将其更改为正确的格式 My_EndDate.ToString(" DD / MM / YYYY&#34)