Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
Try
gSQL = "insert into Sale values("
gSQL += "'" & txtDocNo.Text & "',"
gSQL += "'" & lblDate.Text & "',"
gSQL += "'" & txtCustomerNo.Text & "',"
gSQL += "'" & lblTotal.Text & "',"
With CMD
.CommandType = CommandType.Text
.CommandText = gSQL
.Connection = cnn
.ExecuteNonQuery()
End With
For i = 0 To ListView1.Items.Count - 1
gSQL = "insert into SaleDetail values("
gSQL += "'" & txtDocNo.Text & "',"
gSQL += "'" & i + 1 & "',"
gSQL += "'" & ListView1.Items(i).Text & "',"
gSQL += "'" & ListView1.Items(i).SubItems(2).Text & "',"
gSQL += "'" & ListView1.Items(i).SubItems(3).Text & "',"
gSQL += "'" & ListView1.Items(i).SubItems(4).Text & "')"
With CMD
.CommandType = CommandType.Text
.CommandText = gSQL
.Connection = cnn
.ExecuteNonQuery()
End With
Next
MessageBox.Show("บันทึกการขายแล้ว")
CutStock()
UpdateDocNo()
GetDocNo()
NewDoc()
Catch ex As Exception
MessageBox.Show("มีรหัสนี้แล้วไม่สามารถเพิ่มได้")
End Try
End Sub
End Class
visual basic 2010 runcloudไม่ได้
Try
gSQL = "insert into Sale values("
gSQL += "'" & txtDocNo.Text & "',"
gSQL += "'" & lblDate.Text & "',"
gSQL += "'" & txtCustomerNo.Text & "',"
gSQL += "'" & lblTotal.Text & "',"
With CMD
.CommandType = CommandType.Text
.CommandText = gSQL
.Connection = cnn
.ExecuteNonQuery()
End With
For i = 0 To ListView1.Items.Count - 1
gSQL = "insert into SaleDetail values("
gSQL += "'" & txtDocNo.Text & "',"
gSQL += "'" & i + 1 & "',"
gSQL += "'" & ListView1.Items(i).Text & "',"
gSQL += "'" & ListView1.Items(i).SubItems(2).Text & "',"
gSQL += "'" & ListView1.Items(i).SubItems(3).Text & "',"
gSQL += "'" & ListView1.Items(i).SubItems(4).Text & "')"
With CMD
.CommandType = CommandType.Text
.CommandText = gSQL
.Connection = cnn
.ExecuteNonQuery()
End With
Next
MessageBox.Show("บันทึกการขายแล้ว")
CutStock()
UpdateDocNo()
GetDocNo()
NewDoc()
Catch ex As Exception
MessageBox.Show("มีรหัสนี้แล้วไม่สามารถเพิ่มได้")
End Try
End Sub
End Class