COSProxy.COSEntities proxy = new COSProxy.COSEntities(new Uri("COSDataService.svc", UriKind.Relative));
COSProxy.Session s = new COSProxy.Session();
proxy.AddObject("Session",
DateTime tempDate = DateTime.Now;
s.StartTime = new DateTime(tempDate.Year, tempDate.Month, tempDate.Day, tempDate.Hour, tempDate.Minute, tempDate.Second, 0);
s.RefreshTime = new DateTime(tempDate.Year, tempDate.Month, tempDate.Day, tempDate.Hour, tempDate.Minute, tempDate.Second, 0);
// Now Save to database.
proxy.BeginSaveChanges(Sav
{
proxy.EndSaveChanges(async
},
null);
// Now it returns an error here, saying: "The version of SQL Server in use does not support datatype 'datetime2'."
// My SQL Server 2005 DB and 2008 DB are both using "datetime" data type for the StartTime and RefreshTime mappings. In other words, the database "datetime" data type corresponds to a C# "DateTime" object in the way they are mapped in the Entity Framework. I believe the Entity Framework takes care of any procedure code necessary in the mapping between C# objects and database datatypes.
Main Topics
Browse All Topics





by: BrandonGalderisiPosted on 2008-10-27 at 08:56:16ID: 22813826
Can you post the code where you are declaring your datetime datatype in your C# code as well as the procedure code where you are executing it against. I'm thinking somehow it thinks it's a date data type which is new to SQL 2008 but not in SQL 2005 and lower.