{使用Northwind Microsoft数据库的VB.NET 2008}如何才能从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
您可以删除不喜欢的列
GridViewName.Columns.Remove("ColumnName")