我有以下代码:
Private Sub setDropdowns()
Using licensingModel As New licensingEntities
SetUpDropdowns(licensingModel.tblLookup_Country, "CountryName", "CountryName", country)
SetUpDropdowns(licensingModel.tblLookup_Country, "CountryName", "CountryName", bizCountry)
SetUpDropdowns(licensingModel.tblLookup_Salutation, "SSalutation", "SSalutation", salutation)
SetUpDropdowns(licensingModel.tblLookup_OrgType, "OrgType", "OTAuto", organisationType)
End Using
End Sub
和子SetUpDropdowns:
Private Sub SetUpDropdowns(ByVal entity As IObjectSet(Of EntityObject), ByVal textColumn As String, ByVal valueColumn As String, ByVal combo As RadComboBox)
combo.DataSource = entity
combo.DataBind()
End Sub
我的问题是我不知道如何定义sub的参数类型。因为它们是每次传递的不同类型的objectSets,我认为IObjectSet(Of EntityObject)
会起作用,但它会给我以下错误:
无法转换类型为'System.Data.Objects.ObjectSet
1[licensingModel.tblLookup_Country]' to type 'System.Data.Objects.IObjectSet
的对象1 [System.Data.Objects.DataClasses.EntityObject]'
有人会有解决方案吗?
答案 0 :(得分:0)
你能不能只使用object作为参数?