Click here to Skip to main content
15,900,818 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have two table, they are foreign key relationship. The parent model use Guid as the primary key.

The child table use

public Guid parentId {get;set;}

as the foreign key.

But when I save data, it occurs to some errors:

Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid column name 'parentId'


What I have tried:

I do not know how to solve it.
Posted
Updated 26-Jan-21 21:51pm

1 solution

Your database table does not contain a column called parentId.

You need to update your database to match your model, or update your model to match your database.
 
Share this answer
 
Comments
rtksmithjoton123 27-Jan-21 20:31pm    
I have the column in the table.
Richard Deeming 28-Jan-21 3:26am    
Well the error message clearly tells you that you don't. Check again.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900