我需要从所选项目的数据源中检索“id”,但它总是抛出标题中提到的相同错误。这里是我的代码无法投入'System.Int32'类型的对象来键入'System.Data.DataRowView'
Dim DMV As DataRowView = LbMCat.SelectedValue 'Here occurs the error
SelectedMainCat = DMV.Item("id")
'Filling the SUB Categories part/same code used to fill Main categories
Dim DataAdapterCats As New MySqlDataAdapter("SELECT * From catS where maincat = '" & SelectedMainCat & "';", MySqlConnection)
Dim dsSc As New DataSet
DataAdapterCats.Fill(dsSc, "SubCategories")
Dim SDataTable As DataTable = dsSc.Tables(0)
LbSCat.DataSource = SDataTable
LbSCat.DisplayMember = "title"
LbSCat.ValueMember = "id"
我不能够感谢你:) –