数据表具有空值 [英] Data Table has null values
本文介绍了数据表具有空值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 FbuildingSettings.vb
- 表单
Public camButtonDtable As DataTable
然后我用它在 Fbuilding.vb
- Form
Then I used it in Fbuilding.vb
- Form
Dim names = From row In FbuildingSettings.camButtonDtable.AsEnumerable() Select row.Field(Of String)("Building") Distinct
For Each word In names
ComboBox1.Items.Add(word)
Next
几乎可以做我想要的,从列中获取每个不同的数据。所以我在 FbuildingSettings.vb中使用该代码
Pretty much do what I want, get each of the distinct data from a column. So I used that code in FbuildingSettings.vb
Dim names = From row In camButtonDtable.AsEnumerable() Select row.Field(Of String)("Building") Distinct
For Each word In names
comboBuilding.Items.Add(word)
Next
我收到错误:
尝试这个:公共camButtonDtable作为新的DataTable
- 它编译,但是comboBox不显示一个东西。
我做错了什么?
I get the error:
Tried this : Public camButtonDtable As New DataTable
- it did compiled, but the comboBox does not display a thing.
What am I doing wrong?
推荐答案
解决方案(这是我使用的):
FbuildingSettings.camButtonDtable = databaseFunctions.GetDataTable(queryBtn) 'to iniatialize data on cambtndtable
这应该是这样的东西(不确定) ):
This should be something like this (not really sure):
Dim queryBtn As String = "SELECT * FROM tblCameraButtons"
FbuildingSettings.camButtonDtable = <DataTable>.Fill(queryBtn)
这篇关于数据表具有空值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文