Insert row into table that has FK obtained from another table - linq -c# -
I have 2 tables, customer and client lists. I PK / FK client ID type GUID
Linux, where I want to include in the client intestate table
ClientInterestRegistration clientRegisteration = new ClientInterestRegistration {ClientID = (from V. DB.Clients where v.Email.Equals (EmailAddress) select New {v.ClientID}). Single (), ClientInterest = SelectedInterests, ..};
Receives the error: type System.Linq.IQueryable
System.Guid
First, query Consider removing new {...}
and changing it:
client id = (v.Clients in DB where v.Email.Equals (email address) v.ClientID Choose). Single ()
Are you doing this, as a property to create a new structure with ClientID
.
However, you should not work at all directly with the key column. Try setting the client
directly to the object:
client = (Select v.Clients in DB where v.Email.Equals (EmailAddress) v) . Single ()
Comments
Post a Comment