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

Update Database From Model error

1 Answer 28 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Steve
Top achievements
Rank 1
Steve asked on 02 Jun 2013, 07:30 AM
Hi,

Update Database From Model (Create Database & Migrate Database) error, How to solved this problem? Please see screenshots.

After Migrate Database
http://s23.postimg.org/u78ufon3f/phpj_HKOt_F.png

After Create Database
http://s12.postimg.org/wmbm45lot/php_RQmvv_F.png

Thanks.

1 Answer, 1 is accepted

Sort by
0
Accepted
Boris Georgiev
Telerik team
answered on 05 Jun 2013, 04:33 PM
Hi,

You cannot create a Primary Key constraint on a column which contains duplicated values. This operation is not an OpenAccess ORM limitation, it is not supported by the MS SQL Server. Telerik OpenAccess ORM cannot change the values in the column to allow the operation to be executed out of the box. To create a Primary Key constraint you have to make sure in the database that all the values in the chosen column are unique.

For the second problem, the target database seems to have a table with the same name as the class you are mapping and you are trying to create it again. In case you would like to create a new database instead of updating the same one, please refer to this documentation article. If OpenAccess doesn't ask you to choose the target database explicitly, you have to change the connection string stored in your app.config or web.config file.
On the other hand, if the database you would like to synchronize your model with does already exist, you can use the Migrate Database option.

I hope that helps. 

Regards,
Boris Georgiev
Telerik
OpenAccess Samples Kit boasts 50+ sample applications providing diverse real-life business solutions. Click to read more and see OpenAccess ORM in action.
Tags
General Discussions
Asked by
Steve
Top achievements
Rank 1
Answers by
Boris Georgiev
Telerik team
Share this question
or