1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
Public mdBDD As OdbcConnection
Public Sub BDD_GrabarUMDbrut(ByVal mois As Integer, ByVal codigoCEDI As Integer, ByVal flujo As String, ByVal almacenes As Integer, ByVal sublinea As Integer, ByVal umd As Integer)
Dim maCommande As Odbc.OdbcCommand = mdBDD.CreateCommand
Dim rqt As String
rqt = "Select umd from UMDbrut where Mes=" & mois & " and CodigoCEDI=" & codigoCEDI & " and Flujo='" & flujo & "' and Almacenes=" & almacenes & " and Sublinea=" & sublinea & ";"
maCommande.CommandText = rqt
Dim monLecteur As OdbcDataReader = maCommande.ExecuteReader
If monLecteur.HasRows() = 0 Then
rqt = "INSERT INTO UMDbrut(Mes,CodigoCEDI,Flujo,Almacenes,Sublinea,Umd) VALUES(" & mois & "," & codigoCEDI & ",'" & flujo & "'," & almacenes & "," & sublinea & "," & umd & ");"
Else
monLecteur.Read()
umd = umd + monLecteur.GetInt64(0)
rqt = "UPDATE UMDbrut set umd=" & umd & " where Mes=" & mois & " and CodigoCEDI= " & codigoCEDI & " and Flujo='" & flujo & "' and Almacenes=" & almacenes & " and Sublinea=" & sublinea & ";"
End If
monLecteur.Close()
maCommande.CommandText = rqt
maCommande.ExecuteNonQuery()
End Sub |
Partager