Dim com1 As SqlCommand
Dim hanliang As Double
Dim isg As Integer
For isg = 0 To 30
hanliang = CDbl(DataGridView1.Rows(isg).Cells(2).Value.ToString)
Dim i As Integer
For i = 0 To 30
MsgBox(DataGridView1.Rows(i).Cells(0).Value.ToString.Trim)
If DataGridView1.Rows(i).Cells(2).Value.ToString.Trim = Nothing Then
hanliang = 0.0
Else
hanliang = CDbl(Me.DataGridView1.Rows(i).Cells(2).Value.ToString)
End If
If TextBox1.Enabled = True Then
comstr = "insert into t_ylyys(materialid,matername,yysid,hanliang) values ('" + TextBox8.Text.ToString.Trim & TextBox2.Text.ToString.Trim + "','" + TextBox3.Text.ToString.Trim + "','" + Trim(Me.DataGridView1.Rows(i).Cells("yysid").Value.ToString) + "',' + hanliang + ')"
Else
comstr = "update t_ylyys set hanliang= ' + hanliang + ' where materialid = '" + TextBox8.Text.ToString.Trim & TextBox2.Text.ToString.Trim + "',yysid = '" + Trim(Me.DataGridView1.Rows(i).Cells("yysid").Value.ToString) + "',matername= '" + TextBox3.Text.ToString.Trim + "' "
End If
com1 = New SqlCommand(comstr, conn)
com1.ExecuteNonQuery()
倚天杖
心有法竹
相关分类