返回表示当前系统对象错误的Stystem.String方法ToString的重载不带1个参数 [英] Return a Stystem.String that represents the current System Object Error No overload for method ToString takes 1 argument

查看:134
本文介绍了返回表示当前系统对象错误的Stystem.String方法ToString的重载不带1个参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在数据库的文本框中绑定(上午9:00)(存储为9:00:00)... Ibind值如下





I wanna Bind (9:00 AM) in my text box from Database(Stored as 9:00:00)...Ibind the value like Below


txtGrace.Text = dt.Rows[0]["GraceTime"].ToString("hh:mm tt" );







返回一个Stystem.String表示当前系统对象

错误

方法ToString没有重载需要1个参数< / pre>




Return a Stystem.String that represents the current System Object
Error
No overload for method ToString takes 1 argument</pre>

推荐答案

dt.Rows [0] [GraceTime]返回Object类型的变量。要使用格式化参数启用ToString(),您必须将其转换为DateTime ...

dt.Rows[0]["GraceTime"] returns a variable of Object type. To enable ToString() with formatting parameter you have to convert it to DateTime...
txtGrace.Text = Convert.ToDateTime(dt.Rows[0]["GraceTime"]).ToString("hh:mm tt" );


这篇关于返回表示当前系统对象错误的Stystem.String方法ToString的重载不带1个参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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