1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| cmd.CommandText = "select cdag AGENCE,cli NUM_CLIENT,cleba CLE_BA,nom NOM,Prenom PRENOM,dna DATE_DE_NAISSANCE,sex SEXE,PrePer PRENOM_PERE,Nomer NOM_MERE,Premer PRENOM_MERE,NIN NIN from f_descrPar where cleba13 in(SELECT cleba13 FROM f_descrPar GROUP BY cleba13 HAVING COUNT(cleba13) > 1) and cli not in (select cli from cledef)"
da.SelectCommand = cmd
cmd.Connection = con
da.Fill(ds, "CLEBA")
dv.Table = ds.Tables("CLEBA")
ds.Tables("CLEBA").PrimaryKey = New DataColumn( {ds.Tables("CLEBA").Columns("cli,cdag")}
Grid_doublon.DataSource = ds.Tables("CLEBA")
'parcourire tous les checkbox si il sont true alor : .....
con.Open()
Dim n As Integer
For n = 0 To Grid_doublon.Rows.Count - 1
If CBool(Grid_doublon.Rows(n).Cells("Checkbox").Value) = True Then
'CHECKBOX coché, je récupère la cléBA de la ligne en cours
Dim strX As String = Grid_doublon.Rows(n).Cells(2).Value
Dim strX13 As String = Mid(strX, 1, 13)
Grid_doublon.Rows(n).Cells(2).Value = strX
cmd.CommandText = "update dbo.f_descrPar set cleba = '" & Trim(Grid_doublon.Rows(n).Cells(2).Value) & "' , cleba13 = '" & Trim(strX13) & "' where cli= '" & Trim(Grid_doublon.Item(1, n).Value) & "' and cdag = '" & Trim(Grid_doublon.Item(0, n).Value) & "'"
cmd.Connection = con
cmd.ExecuteNonQuery()
Else
Dim st As String = Grid_doublon.Rows(n).Cells(2).Value
Dim x As String
Dim s As Integer
Dim cle As String
x = Mid(st, 14, 2)
If Mid(x, 1, 1) = "0" Then
s = CType(Mid(x, 2, 1), Integer) + 1
x = Mid(x, 1, 1) & s
Else
x = Mid(st, 14, 2) ' x= "10"
s = CType(x, Integer) + 1
x = CType(s, String)
End If
cle = Mid(Grid_doublon.Rows(n).Cells(2).Value, 1, 13)
Grid_doublon.Rows(n).Cells(2).Value = cle & x
End If
Next |
Partager