ASP.NET的GridView抛出:的SQL Server所使用的版本不支持数据类型“日期” [英] ASP.NET GridView throws: The version of SQL Server in use does not support datatype 'date'

查看:210
本文介绍了ASP.NET的GridView抛出:的SQL Server所使用的版本不支持数据类型“日期”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何应对不支持日期的服务器?对不起,这么模糊的问题。请让我知道我应该补充什么addtional细节。谢谢你。

How to deal with a server that doesn't support 'date'? Sorry for such a vague question. Please let me know what addtional details I should add. Thanks.

下面的错误:

的SQL Server所使用的版本不支持数据类型日期。
说明:执行当前Web请求的执行过程中发生未处理的异常。请查看有关错误的详细信息的堆栈跟踪以及它起源于code。

The version of SQL Server in use does not support datatype 'date'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

异常详细信息:System.ArgumentException:的SQL Server使用不支持数据类型日期的版本

Exception Details: System.ArgumentException: The version of SQL Server in use does not support datatype 'date'.

源错误:

当前Web请求的执行过程中生成了未处理的异常。有关异常的来源和位置信息可以使用异常堆栈跟踪下面确定。

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


有关从服务器浏览器中的列属性,我指定的列的日期时间,所以我不知道为什么自动生成的ASP.NET的GridView试图与合作< STRONG>日期的类型,而不是一个日期时间类型。

For the Column Properties from the server explorer, I've specified the column as a datetime, so I'm not sure why the auto generated ASP.NET gridview is trying to work with a date type as opposed to a datetime type.

下面是由导致错误的ASP.NET 2.0网格视图中的code自动生成的:

Here's the code auto-generated by the ASP.NET 2.0 grid view that is causing the error:

难道还好只是改变的DbType =日期来的DbType =日期时间? (它似乎工作。)

Is it okay to just change DbType="Date" to DbType="Datetime"? (It seems to work.)

推荐答案

最有可能你正在寻找要么的 日期时间 SMALLDATETIME 类型:

Most likely you are looking for either the datetime or smalldatetime type:

日期和时间数据类型重新presenting日期和时间

Date and time data types for representing date and time of day

这篇关于ASP.NET的GridView抛出:的SQL Server所使用的版本不支持数据类型“日期”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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