为什么不能给dataset中的表赋值,有解决办法吗
1个回答
展开全部
建议把所有checkbox 的值遍历,代码是这样的:
Dim datarow As DataRow datarow = ds.Tables("Emp_base1").NewRow() If ds.Tables("Emp_base1").Columns.Count = 0 Then For i As Integer = 1 To Me.DataGridView1.Columns.Count - 1 ds.Tables("Emp_base1").Columns.Add(Me.DataGridView1.Columns(i).Name) Next End If ds.Tables("Emp_base1").Rows.Clear() For i As Integer = 0 To Me.DataGridView1.Rows.Count - 1 If Me.DataGridView1.Rows(i).Cells(0).Value = True Then For a As Integer = 0 To Me.DataGridView1.Columns.Count - 2 Dim b = a + 1 datarow(a) = Me.DataGridView1.Rows(i).Cells(b).Value Next ds.Tables("Emp_base1").Rows.Add(datarow) End If Next
Dim datarow As DataRow datarow = ds.Tables("Emp_base1").NewRow() If ds.Tables("Emp_base1").Columns.Count = 0 Then For i As Integer = 1 To Me.DataGridView1.Columns.Count - 1 ds.Tables("Emp_base1").Columns.Add(Me.DataGridView1.Columns(i).Name) Next End If ds.Tables("Emp_base1").Rows.Clear() For i As Integer = 0 To Me.DataGridView1.Rows.Count - 1 If Me.DataGridView1.Rows(i).Cells(0).Value = True Then For a As Integer = 0 To Me.DataGridView1.Columns.Count - 2 Dim b = a + 1 datarow(a) = Me.DataGridView1.Rows(i).Cells(b).Value Next ds.Tables("Emp_base1").Rows.Add(datarow) End If Next
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询