Question LINQ to entities / ADD, INSERT / Error converting types

novayazemlya

New member
Joined
Nov 2, 2011
Messages
2
Programming Experience
5-10
Hello,
I have created a class and attributed parameters according to the names of the columns in my table. Then I want to launch DC.addtoTABLENAME(classname), unfortunately I get an error telling me that the "value of type NAME OF MY CLASS" can not be converted to "windowsapplication1.MYTABLENAME". Please do find the code...all help is welcome.
Class BookableDay
Property Room0 As Int32
Property Room1 As Int32
Property Room2 As Int32
Property Room3 As Int32
Property Room4 As Int32
Property Room5 As Int32
Property Room6 As Int32
Property Room7 As Int32
Property Room8 As Int32
Property Room9 As Int32
Property Room10 As Int32
Property Room11 As Int32
Property Room12 As Int32
Property Room13 As Int32
Property Room14 As Int32
Property Av_Date As DateTime
Property av_avail_id As Int32
End Class


Dim prod As New BookableDay
With prod
.Room0 = 1
.Room1 = 1
.Room2 = 1
.Room3 = 1
.Room4 = 1
.Room5 = 1
.Room6 = 1
.Room7 = 1
.Room8 = 1
.Room9 = 1
.Room10 = 1
.Room11 = 1
.Room12 = 1
.Room13 = 1
.Room14 = 1
.av_avail_id = 1
.Av_Date = #12/29/1976#
End With
dctest.AddTotblavailability(prod)
Error: Error 1 Value of type 'WindowsApplication1.frmInventory.BookableDay' cannot be converted to 'WindowsApplication1.tblavailability'.
 
Hi,
I made a logical error and found the solution. I had to map the instance of my class to the table iso to the class itself.
Greets,
Stijn
 
Back
Top