Dim com1 As SqlCommandDim hanliang As DoubleDim isg As IntegerFor isg = 0 To 30hanliang = CDbl(DataGridView1.Rows(isg).Cells(2).Value.ToString)Dim i As IntegerFor i = 0 To 30MsgBox(DataGridView1.Rows(i).Cells(0).Value.ToString.Trim)If DataGridView1.Rows(i).Cells(2).Value.ToString.Trim = Nothing Thenhanliang = 0.0Elsehanliang = CDbl(Me.DataGridView1.Rows(i).Cells(2).Value.ToString)End IfIf TextBox1.Enabled = True Thencomstr = "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 + ')"Elsecomstr = "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 Ifcom1 = New SqlCommand(comstr, conn)com1.ExecuteNonQuery()
添加回答
举报
0/150
提交
取消