2

次のコードがあります。

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

私の問題は、サブのパラメーター タイプを定義する方法がわからないことです。それらは毎回渡されるオブジェクトセットのタイプが異なるため、うまくいくと思いIObjectSet(Of EntityObject)ましたが、次のエラーが発生します。

1[licensingModel.tblLookup_Country]' to type 'System.Data.Objects.IObjectSetタイプ「System.Data.Objects.ObjectSet 1[System.Data.Objects.DataClasses.EntityObject]」 のオブジェクトをキャストできません‌</p>

誰かがこれに対する解決策を持っていますか?

4

1 に答える 1

0

オブジェクトをパラメーターとして使用することはできませんか?

于 2012-04-12T20:49:41.933 に答える