Last post Mar 31, 2010 02:05 AM by CHVincent
Mar 20, 2010 08:34 AM|CHVincent|LINK
I'm using VS 2005 and SQL SERVER 2005,
now i have a table with only two columns (their types: DateTime and SmallDateTime)
i key in some new records.
Now I want to use GridView to retrieve that table, and use Calendar.SelectedDate as a parameter used in WHERE statement,
I press "Test Query" and pop out a window "Parameter Values Editor",
here comes the problem.. how come the "DbType" is always 'Date'?
After i click the list and select 'DateTime', but next time it will recover back to 'Date'
I have to go to the source code find the "Dbtype" and change from "Date" to "DateTime" manually EVERYTIME~
<asp:ControlParameter ControlID="Calendar1" DbType="Date" Name="Date" PropertyName="SelectedDate" />
<asp:ControlParameter ControlID="Calendar1" DbType="DateTime" Name="Date" PropertyName="SelectedDate" />
if i don't do this, it will lead to error:
the version of sql server in use does not support datatype 'date'
It's weird that my original datatype is "DateTime" but the Dbtype is ALWAYS
"Date" and lead to error everytime.
How can i solve that, please??
i'm a beginner.. Thanks ~~!
Mar 20, 2010 10:13 AM|rtpHarry|LINK
that is wierd because the Date type is new in sql server 2008.
where did you get the code from? could it have been used against a 2008 database in the past?
I am just wondering if whatever data access code you are using was built against 2008 to start off with.
What is this "Test query" button that you are using? Which data access technology is it a part of?
Mar 20, 2010 06:49 PM|kanasz.robert|LINK
look at this:
Mar 21, 2010 04:04 AM|CHVincent|LINK
Here are some explanation with Pictures and descriptions.
sorry the site is in Chinese. But you can just click on the picure to see the next picture
This computer is not mine before, i think it is newly installed and with only sql server 2005/ vs 2005
I don't know why are there so many puzzles~ @_@"...
Mar 24, 2010 05:32 AM|Jian Kang - MSFT|LINK
I can reproduce the issue in both VS 2005 RTM and VS 2005 SP1.
However, it works fine in VS 2008, so I think the issue is already fixed. Please use VS 2008 or VS 2010 instead.
Mar 25, 2010 11:39 PM|prush|LINK
Well, I'm noticing something the same yet a little different.
VS2008 with SQL2005
The field in SQL2005 is a datetime field but when configuring the sql data source to generate insert/update/delete statements, the DBType in the parameters for both the insert and update are set as date.
when it should be
Is there any way to fix this so that the auto created parameters will create the correct dbtype attribute for these parameters when using the auto generated insert/update/delete statements?
Mar 31, 2010 02:05 AM|CHVincent|LINK
I think you can read the article above, Mr. Jian Kang has provided the information that he can reproduce the issue in both VS 2005 RTM and VS 2005 SP1. so.. maybe the "fix" here is to use VS2008.... or manually replace the dbtype to DateTime(using Replace
Hope you can solve it.
BTW, thanks for Mr. Jian Kang's reply.~