如何在Datagridview C#Visual Studio 2010中查看日期? [英] how to view date in datagridview c# visual studio 2010?

查看:145
本文介绍了如何在Datagridview C#Visual Studio 2010中查看日期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的项目中,我使用的是使用Visual Studio的datagridview,而我的问题是日期列将不显示任何内容.当我在mysql中检查数据库时,日期值在那里,但在datagridview中它只是空白.其他所有字段均可见.

In my project im using a datagridview using visual studio and my problem is the date column will not display anything. when i checked my database in mysql the date values are there but in the datagridview its just blank. all the other fields are visible. How do i get the date to show in my datagridview?

推荐答案



如果您使用的是asp:BoundField,则为它.
确保日期"的字段列正是您在其中定义的内容:
DataField ="REQST_DATE"并将连接中的允许零日期时间"设置为true.

客户代码中的示例:
Hi,

If you are using asp:BoundField, here is it.
Be sure that the field column of your Date is exactly what your defind in:
DataField="REQST_DATE" and set "Allow Zero Datetime" to true in your connection.

Example in your client code:
<asp:BoundField DataField="REQST_DATE" HeaderText="Requested Date" ItemStyle-HorizontalAlign="Left"
  HeaderStyle-HorizontalAlign="Left">
  <HeaderStyle HorizontalAlign="Left" />
  <ItemStyle HorizontalAlign="Left" />
</asp:BoundField>


请参阅这篇文章,它对您有很大帮助.希望它能起作用.
GridView全部集成 [
Please see this article, it can help you much. Hope it works.
GridView all in one[^]


您可以看到有关日期"的问题数据GridView中的时间格式",位于:
C#-DataGridView中的DateTime格式问题.希望对您有帮助.
You can see question about "Date Time Format In Data GridView" in:
C# - DateTime format question in DataGridView . Hope it help you.


这篇关于如何在Datagridview C#Visual Studio 2010中查看日期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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