datetime在sql srever中将问题存储为datetime [英] datetime storing problem as datetime in sql srever

查看:73
本文介绍了datetime在sql srever中将问题存储为datetime的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能将日期时间选择器的值存储到数据库中作为datetime数据类型。

但是我可以将它存储为nvarchar(MAX)..

为什么?

i cant store the value from datetime picker to database as "datetime" datatype.
but i can store it as nvarchar(MAX) ..
WHY?

推荐答案

亲爱的朋友,



我认为你将日期值保存在dd / MM / yyyy 类型。



尝试以MM / dd / YYYY格式存储它。与dd / MM / yyyy格式一样,SQL Server将其视为字符串,这是您能够以nvarchar(MAX)存储数据的原因。


谢谢和问候



Varun Sareen
Dear Friend,

I think you are saving the Date value in "dd/MM/yyyy" type.

Try to store it in "MM/dd/YYYY" format. As in "dd/MM/yyyy" format SQL Server considers it as a string that is the reason you are able to store the data in nvarchar(MAX).

Thanks & Regards

Varun Sareen


这篇关于datetime在sql srever中将问题存储为datetime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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