如何使用vb.net编码在oracle 10g中插入日期和时间 [英] how to insert date and time in oracle 10g using vb.net coading

查看:90
本文介绍了如何使用vb.net编码在oracle 10g中插入日期和时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尊敬的先生/妈妈

我想将日期和时间存储在oracle 10g数据库中.
我正在尝试插入日期和时间,而我的vb.net语句是

Respected sir/mam

I want to store a date and time in oracle 10g database.
I am trying to inserting a date and time and my vb.net statement is

dsNewRow.Item("date_time") = Format(DateTime.Today, ("yyyy-MM-dd HH:mm:ss.000"))


在上面的语句中,只有日期正在数据库中插入.但是我想插入日期和时间.我的date_time字段数据类型为date.
怎么可能?

请帮帮我.

预先谢谢您.


in the above statement only date is inserting in database. But i want to inserting date as well as time. My date_time fields data type is date.
how it is possible?

Please help me.

Thank You in advance.

推荐答案

我记得,Oracle可以"将DateType字段值作为字符串处理.如果您编写查询,则日期必须在where-clause中以字符串形式给出:

选择* From HireDate> =''01 -01-2011 00:00:00''

因此,放置一个字符串值是正确的.

此外,当您使用来自Oracle而不是来自Microsoft的驱动程序时,可以使用Oracle-Namespace中的OracleDateTime结构.

不建议使用Microsoft的Oracle驱动程序.
I remember, that Oracle "can" handle DateType field values as string. If you write a query the date has to be given as string in the where-clause:

Select * From Employee Where HireDate >= ''01-01-2011 00:00:00''

So, it is correct that you put a string value.

Furthermore, you can use the OracleDateTime structure from the Oracle-Namespace when you use the drivers from Oracle and not from Microsoft.

Using the Oracle drivers from Microsoft is not recommended.


这篇关于如何使用vb.net编码在oracle 10g中插入日期和时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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