如何解决此错误: [英] how to resolve this error:

查看:81
本文介绍了如何解决此错误:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 Convert.ToDateTime(ds.Tables [ 0 ]。行[i] [  Timesheetdate]。ToShortDateString()); 



如何解决此错误:

 '  object'不包含定义  '  ToShortDateString'且不扩展方法'  ToShortDateString'接受类型'的第一个参数  object'可以找到(你是否缺少使用指令或汇编参考?)

解决方案

这样写

< pre lang =c#> Convert.ToDateTime(ds.Tables [ 0 ]。行[i] [ Timesheetdate 。])ToShortDateString();


Convert.ToDateTime(ds.Tables[0].Rows[i]["Timesheetdate"].ToShortDateString());


How to resolve this error:

'object' does not contain a definition for 'ToShortDateString' and no extension method 'ToShortDateString' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)

解决方案

write like this

Convert.ToDateTime(ds.Tables[0].Rows[i]["Timesheetdate"]).ToShortDateString();


这篇关于如何解决此错误:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆