我想添加持续时间 [英] i want to add time duration

查看:125
本文介绍了我想添加持续时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好先生...我想添加时间像00:15 ..我的数据库字段是datetime ....我已经使用maskedtextbox插入时间..但它显示我在数据库数据类型中的错误bcz是datetime .. ..所以任何解决方案...我想只插入数据库时​​间而不是日期..plz帮助我.......

hello sir...i want to add time like 00:15 ..my database field is datetime....i have use maskedtextbox to insert time..but it show me error bcz in database datatype is datetime....so any solution for this...i want insert only time to the databse not date..plz help me.......

推荐答案

你好,



如果您的服务器是2008 SQL服务器或更高版本,那么您可以使用时间 [ ^ ]



else



将您的字段设置为varchar并将值放入其中。



或者



您可以将您的归档设置为日期时间并始终添加最小值日期值时间,但它将占用比varchar更多的空间。



:)
Hi,

If your server is 2008 SQL server or higher then you can use time [^]

else

Set your field as varchar and put the value in it.

or else

you can set your filed as date time and always add min date value with the time but it will occupy more space than varchar.

:)

sql server 2005中


只有Time数据类型不可用

所以,它会节省日期时间



当你要保存这样的添加日期

in sql server 2005 only Time datatype is not available
so, it will save datetime

when you are going to save add date like this
string dttm = "1900-01-01 " + MaskEditbox1.text;



查询...


in query...

Query = insert into tbl(dttm) value(" + dttm + ")";





快乐编码!

:)



Happy Coding!
:)


这篇关于我想添加持续时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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