{VB.NET 2008使用Northwind Microsoft Database} 如何从demogrid中删除名称只有id的列? (不使用sql代码)
Dim strSQL As String = _
"SELECT * FROM Products WHERE CategoryID=1"
Try
Using adapter As New OleDbDataAdapter(strSQL, _
My.Settings.OleDbConnectionString)
Dim ds As New DataSet
adapter.Fill(ds, "ProductInfo")
demoList.DisplayMember = "ProductName"
demoList.ValueMember = "ProductID"
demoGrid.DataSource = ds.Tables("ProductInfo")
End Using
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
答案 0 :(得分:0)
You can remove the column you don't like
GridViewName.Columns.Remove("ColumnName")