关于将datetime插入数据库。 [英] About insert datetime into database.

查看:72
本文介绍了关于将datetime插入数据库。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我尝试通过ODBC将日期时间插入到数据库中,数据可以插入到数据库中,但第二个和毫秒缺失,(对于例如:2019-4-15 15:35:00.000),sqlstate是01004,但是当我使用sqlserer 2012
和2014时没有问题。

I try to insert the datetime into the database by ODBC, the data can be insert into the data base but the second and millisecond has missing, (for example :2019-4-15 15:35:00.000) , and the sqlstate is 01004, but there is no problem when I use sqlserer 2012 and 2014.

我也是编写示例来测试它,但是当代码转到SQLExecDirect时会遇到一些问题(SQLstate

42000
),这是代码:

I also write the example to test it ,but get some problem when the code go to the SQLExecDirect (SQLstate 42000), here is the code:

推荐答案

>我尝试通过ODBC将日期时间插入到数据库中,数据可以插入数据库但第二个和毫秒缺失,(例如:2019-4-15 15:35:00.000),sqlstate是01004 ,但是当我使用sqlserer
2012和2014时没有问题。

> I try to insert the datetime into the database by ODBC, the data can be insert into the data base but the second and millisecond has missing, (for example :2019-4-15 15:35:00.000) , and the sqlstate is 01004, but there is no problem when I use sqlserer 2012 and 2014.

所以你什么时候有问题?你得到了什么错误信息?你的帖子不是很清楚。

So when do you have problem? And what error message do you get? Your post is not very clear.


这篇关于关于将datetime插入数据库。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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