错误CS0266:无法将类型“object”隐式转换为“int” [英] error CS0266: Cannot implicitly convert type 'object' to 'int'
本文介绍了错误CS0266:无法将类型“object”隐式转换为“int”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
错误CS0266:无法将类型object隐式转换为int。存在
显式转换(是否缺少转换?)
error CS0266: Cannot implicitly convert type 'object' to 'int'. An explicit conversion exists (are you missing a cast?)
int dd= 6000;
sqlCmdDefaultTime = new SqlCommand("myQuery", sqlCon);
sqlDefaultTime = sqlCmdDefaultTime.ExecuteReader();
while (sqlDefaultTime.Read())
{
dd= sqlDefaultTime[1];
}
如何投放
推荐答案
简单转换为 int
:
dd = (int)sqlDefaultTime[1];
这篇关于错误CS0266:无法将类型“object”隐式转换为“int”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文