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

Issue upgrading project to fluent - Invalid column name

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.
AndrePereira
Top achievements
Rank 1
AndrePereira asked on 07 Aug 2017, 05:11 PM

Hi,

I was put on this project to perform an upgrade for the newer telerik version.

One of the issues i have been trying with no success, is upgrading the data modeling to fluent.

 

I followed, the the steps i found at http://www.telerik.com/blogs/benefits-of-code-only-mapping-and-how-to-get-them, and i was able to generate and import the classes for code mapping. However, i am getting the exception "Telerik.OpenAccess.RT.sql.SQLException: Invalid column name 'ID2'."

It seems, the system is trying to do a select to the DB with that ID2 field, that does not exist.

 

This is the query that i found in the exception:

SELECT [Acronym] AS COL1, [AddressID] AS COL2, [AddressID] AS COL3, [BI] AS COL4, [BirthDate] AS COL5, [Board] AS COL6,
[BossEmail] AS COL7, [Department] AS COL8, [Email] AS COL9, [Name] AS COL10, [Nationality] AS COL11, [Nif] AS COL12,
[Passport] AS COL13, [Phone] AS COL14, [PlaceOfBirth] AS COL15, [ID2] AS COL16, [QualificationDetail] AS COL17, [QualificationID] AS COL18 FROM [ET_Person] WHERE [ID] = ?     

 

I don't understand where that ID2 field came from, and i don't know why there isn't an ID field int the select statement.

 

There is an association between users(Utilizadores) and Person, the association in the code is the following:

for Person,

configuration.HasAssociation(x => x.Utilizadors).HasFieldName("utilizadors1").WithOpposite(x => x.Person).HasConstraint((y, x) =>  x.PersonID == y.ID ).IsManaged().IsDependent().WithDataAccessKind(DataAccessKind.ReadWrite);

and for Utilizadores, 

configuration.HasAssociation(x => x.Person).HasFieldName("person1").WithOpposite(x => x.Utilizadors).HasConstraint((x, y) =>  x.PersonID == y.ID ).IsManaged().IsRequired().WithDataAccessKind(DataAccessKind.ReadWrite);

 

I would appreciate any help in this matter.

If you need any more information, please let me know.

Thanks!

1 Answer, 1 is accepted

Sort by
0
AndrePereira
Top achievements
Rank 1
answered on 09 Aug 2017, 11:38 AM

Hi,

I was able to solve the issue.

In my case, i had a problem with the foreign keys, of one of the tables that was connected to person.

 

cheers

Tags
Databases and Data Types
Asked by
AndrePereira
Top achievements
Rank 1
Answers by
AndrePereira
Top achievements
Rank 1
Share this question
or