This is a migrated thread and some comments may be shown as answers.

SQLServer 2008 data type

1 Answer 75 Views
Databases and Data Types
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jonathan
Top achievements
Rank 1
Jonathan asked on 24 Mar 2009, 03:15 PM
Hi,
I have an important SQLServer 2008 project which is giving issues with unsupported data types. A number of columns are of the data type 'DATE' which OpenAccess maps to System.String. This is causing a issues in the controls and code for the web application and I don't want to changes the data type in the tables to DateTime and then try to rebuild the OA layer (many problems with this).

I see in the OA Backend Configuration Settings dialog that it is possible to change the mapped types but DATE does not appear in the list of SQL types to pick from (which I guesss is why OA defaults the conversion to string). Is it possible to add the DATE SQLServer data type to the drop down to pick from to allow me to map this to a System.DateTime? Or is this hardcoded into one of the DLLs?

I'm happy to do this as SQLServer implicitly converts a DateTime to a Date and stores the correct values.

Regards,
Jonathan

1 Answer, 1 is accepted

Sort by
0
Jan Blessenohl
Telerik team
answered on 26 Mar 2009, 08:44 AM
Hello Jonathan Simmons,
The reverse engineering calculation for 'Date' is hard coded. One workaround at the moment is that you change the mapping by hand after the reverse engineering wizard does generate everything.

The mapping nodes have to have this entry:
          <class name="Person">  
            <field name="birthday">  
              <extension key="db-column">  
                <extension key="db-sql-type" value="DATE" /> 
              </extension> 
            </field> 
          </class> 
 
And the field and property type in your classes must be changed to DateTime.

Another workaround is to have a copy of your schema, change all date to datetime and use this for reverse engineering. During runtime you can use your original schema.

We will add the date mapping to the reverse egnineering wizard.

Greetings,
Jan Blessenohl
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Databases and Data Types
Asked by
Jonathan
Top achievements
Rank 1
Answers by
Jan Blessenohl
Telerik team
Share this question
or