Dataset,用SQL语句可以取需要的数据集
解决方案 »
- DevExpress中的treelist控件,节点图标显示问题
- C# 数据库操作 问题。判断是否为空记录的问题???
- 一个关于form1.visible的问题。
- 如何获得TabPage中包含的子控件?
- 【急!!!】C#移动视频控件出现闪屏【求大神帮忙】
- 用C#编辑个MP3播放器有多少种方法 能给点源代做下参考么
- 错误提示: at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
- VS2012WEB项目如何附加到进程进行本机调试
- 文件查找
- 怎么修改我的资源文件啊*.resources
- 急!哪有 .net 的组件下载啊?
- System.Windows名称空间引用有点怪问题
Dim tblService As DataTable ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Fill tblServie with windows servcie
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub FillDataSet()
tblService = New DataTable("Service")
Dim clName As DataColumn = New DataColumn("Name", GetType(String))
Dim clStatus As DataColumn = New DataColumn("Status", GetType(String))
Dim clType As DataColumn = New DataColumn("Type", GetType(String)) With tblService
.Columns.Add(clName)
.Columns.Add(clStatus)
.Columns.Add(clType)
End With Dim service As ServiceController
Dim services() As ServiceController = ServiceController.GetServices() For Each service In services
Dim row As DataRow = tblService.NewRow()
row(0) = service.ServiceName
row(1) = service.Status
row(2) = service.ServiceType
tblService.Rows.Add(row)
Next
End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Binding the DataGrid
'
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Sub MapDataGrid()
Dim tsService As DataGridTableStyle = New DataGridTableStyle(False)
tsService.MappingName = "Service" Dim tbcName As New DataGridTextBoxColumn
With tbcName
.MappingName = "Name"
.HeaderText = "Name"
.Width = 100
End With
tsService.GridColumnStyles.Add(tbcName) Dim tbcStatus As New DataGridTextBoxColumn
With tbcStatus
.MappingName = "Status"
.HeaderText = "Status"
.Width = 100
End With
tsService.GridColumnStyles.Add(tbcStatus) Dim tbcType As New DataGridTextBoxColumn
With tbcType
.MappingName = "Type"
.HeaderText = "Type"
.Width = 150
End With
tsService.GridColumnStyles.Add(tbcType)
dgrdService.TableStyles.Add(tsService) dgrdService.DataSource = tblService End Sub
select t1.col1,t2.col2,t3.col3
form t1,t2,t3
where t1.sId=t2.sId
and t1.sId=t3.sId
用select来选择 然后给adpter 然后把datagrid的datasource 设置成你的adpter就可以了 好象还要用到dataset吧
dataset在.net是个好东西啊! 呵呵