如何使用datetimepicker仅将时间添加到数据库 [英] How to add only time using datetimepicker to database

查看:302
本文介绍了如何使用datetimepicker仅将时间添加到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个人都好!



我有一个Windows窗体。它还有数据库。我将数据添加到表(empattT)。

有2个datetimepickers.one用于添加intime,其他用于添加outtime。



在数据库中使用的数据类型是datetime。



如何使用datetimepicker只为该表添加时间。



我没有为datetimepicker写任何代码。 />


请帮帮我

解决方案

看到: http://www.functionx.com/vb/controls/timepicker.htm [ ^ ]



你唯一需要做的就是将它转换为C#:doh:



问候......


string myTime = dateTimePicker1.Value.ToShortTimeString();



这也可以。

Hellow everybody!

I have a windows form.and also it has database.I add data to table(empattT).
there are 2 datetimepickers.one is use to add intime other one is used to add outtime.

In the database used datatype is datetime.

how am I only add time to that table using datetimepicker.

I didn't write any code for datetimepicker.

please help me

解决方案

See this: http://www.functionx.com/vb/controls/timepicker.htm[^]

Only thing you have to do is convert it to C# :doh:

Regards...


string myTime = dateTimePicker1.Value.ToShortTimeString();

this will do as well.


这篇关于如何使用datetimepicker仅将时间添加到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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