出生日期现场问题 [英] Date of Birth field problem

查看:88
本文介绍了出生日期现场问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行查询时



从emp中选择*;



并在以下位置显示这些信息gridview它显示出生时的数据,如1988/2/3 12:00 AM。

当我在数据库中运行此查询时,日期显示为1988/2/3。

i只想在gridview中显示数据请帮我解决问题...

解决方案

使用正确的格式字符串,例如,如果你使用绑定字段

 <   asp:BoundField     DataField   =  YourDateField    HeaderText   =  SomeHeader    

< span class =code-attribute> DataFormatString = {0:yyyy / MM / dd} / >


 <   asp:Label     ID   =  Label7    runat   =  server  

文本 =' <% #Eval( columnname {0:yyyy / MM / dd}%> ' > < / asp:Label >


when i run the query

Select * from emp;

and display these information in a gridview it display time with the data of birth like 1988/2/3 12:00AM.
and when i run this query in database just date is display like 1988/2/3.
i just want to display the data in the gridview please help me to solve the problem...

解决方案

use proper format string, for example if you use bound field

<asp:BoundField DataField="YourDateField" HeaderText="SomeHeader" 

                    DataFormatString="{0:yyyy/MM/dd}"  />


<asp:Label ID="Label7" runat="server"

                                    Text='<%# Eval("columnname","{0:yyyy/MM/dd}") %>'></asp:Label>


这篇关于出生日期现场问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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