WPF记录集列表框数据绑定?
如何将记录绑定到列表框的itemsource cn.ConnectionString = "Provider=Microsoft.Ace.Oledb.12.0; Data Source=" & My.Application.Info.DirectoryPath.ToString() & "\mvdata.accdb;" cn.Open() If rs.State = True Then rs.Close() rs.Open("Select * from company", cn, ADODB.CursorTypeEnum.adOpenDynamic,ADODB.LockTypeEnum.adLockOptimistic) slistbox.ItemsSource = ????? cn.ConnectionString=“Provider=Microsoft.Ace.Oledb.12.0;数据源=“&My.Application.Info.DirectoryPath.ToString()&”\mvdata.accdb;” cn.Open() 如果rs.State=True,则rs.Close() rs.Open(“从公司选择*”,cn,ADODB.CursorTypeEnum.adOpenDynamic,ADODB.LockTypeEnum.adlockoptimize) slistbox.ItemsSource=?????WPF记录集列表框数据绑定?,wpf,vb.net,data-binding,adodb,recordset,Wpf,Vb.net,Data Binding,Adodb,Recordset,如何将记录绑定到列表框的itemsource cn.ConnectionString = "Provider=Microsoft.Ace.Oledb.12.0; Data Source=" & My.Application.Info.DirectoryPath.ToString() & "\mvdata.accdb;" cn.Open() If rs.State = True Then rs.Close() rs.Open("Select * from company", c
希望有人能帮助我。谢谢。首先用记录集中的数据填充
数据表
,然后将列表框
的项目资源设置到数据表
。大概是这样的:
cn.ConnectionString = "Provider=Microsoft.Ace.Oledb.12.0; Data Source=" & My.Application.Info.DirectoryPath.ToString() & "\mvdata.accdb;"
cn.Open()
If rs.State = True Then rs.Close()
rs.Open("Select * from company", cn, ADODB.CursorTypeEnum.adOpenDynamic,ADODB.LockTypeEnum.adLockOptimistic)
Dim oleDbAdapter As New OleDbDataAdapter()
Dim dataTable As New DataTable()
oleDbAdapter.Fill(dataTable, rs)
slistbox.ItemsSource = dataTable
我没有编译它,但我希望您能理解它为什么不识别DataTable()它说DataTable未定义。我错过什么了吗?