如何使用VB.NET保存在运行时生成的多个datagridview值

时间:2016-04-04 07:44:29

标签: mysql vb.net

我创建面板 在其内部标签,datagridview在数据库中的运行时基础

示例:我在运行时获得了3组面板 问题:当我单击保存按钮时,最后一组面板仅保存到数据库

如何在运行时在所有生成的datagridview中将datagrid值保存到我的数据库库

这是我将值保存到数据库中的代码:

  For Each row As DataGridViewRow In dgv.Rows
  a.getAllCandidateValue(lbl.Text) 
  i = a.id 
  For r As Integer = 0 To dgv.RowCount - 1 
    If ii = dgv.RowCount - 1 Then 
      Exit For 
    Else 
      For cy As Integer = 0 To dgv.ColumnCount - 1 
         Dim scorePercentage As Double 
         strng = dgv.Columns(cy).HeaderText 
         Dim cellValue As String = dgv.Rows(r).Cells(cy).Value
    cr.getcriteriaIdByString(strng) scorePercentage = cellValue * cr.cri_per 
cScore.saveScoreCandidate(cr.id, scorePercentage, i, c.CATEGORY_ID, GLOBAL_VARS.currentid) 
Next 
cScore.getScore(i, c.CATEGORY_ID, GLOBAL_VARS.currentid) 
Dim total As Double = cScore.total cScore.saveScoreBYcategory(i, c.CATEGORY_ID, total, GLOBAL_VARS.currentid) 
End If 
ii = ii + 1 
Next 
Next

0 个答案:

没有答案