如何从数据库访问日期时间..... [英] how to access datetime from database.....
本文介绍了如何从数据库访问日期时间.....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
通过过程,我得到了两个日期时间字段...例如from_date和to_date.
我可以访问html页上的标签字段上的那两个字段吗?.
Through procedure i got two datetime field...like from_date and to_date.
can i access Those two fields in the html page on label field..
推荐答案
假定您在代码中具有可用的值,并且已在上创建了2个标签这样的页面:
Assuming that you have the values available in the code and that you have created 2 labels on the page like so:
<asp:Label ID="Label1" runat="server"/>
<asp:Label ID="Label2" runat="server"/>
在代码中(可能在OnLoad
方法中):
in code (perhaps in an OnLoad
method):
string start = db.Date1;
string end = db.Date2;
Label1.Text = start;
Label2.Text = end;
其中db.Date1和db.Date2代表从数据库中提取的值(但是您已经做到了).
请注意,以上内容非常简单:您需要进行更改以满足您的要求.
where db.Date1 and db.Date2 represent the values extracted from the database (however you have made that happen).
Note that the above is very simplistic: you''ll need to alter to suit your requirement.
这篇关于如何从数据库访问日期时间.....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文