DataGridview中绑定问题..............................................
在vb.net中...
我开始是这样写的..我是实现把数据显示在datagridview上,同是绑定到BindingNavigator1中......
Dim binds As BindingSource = New BindingSource
'Dim dt As DataTable = New DataTable
Dim ds As DataSet = New DataSet
Dim da As Odbc.OdbcDataAdapter
Dim Conn As New Odbc.OdbcConnection
Conn = Me.comm.DBopen()
da = New Odbc.OdbcDataAdapter(sSelectCmd, Conn)
da.Fill(ds)
binds.DataSource = ds.Tables(0)
Me.DgViewReportCode.DataSource = binds
Me.BindingNavReportCode.BindingSource = binds
现在我又要清空datagridview
我用到了datagridview.DataSource = DBNull.Value
为什么不能清空哦...
[解决办法]
datagridview.DataSource = nothing
试试这个
[解决办法]
DBNull表示空的数据类型,再取它的值自然不对了