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
| Public Sub UpdateASSOCIATE(ByVal drAssociate As XSD_Sabam.XSD.ASSOCIATERow, ByVal AncienCodeSabam As String)
Dim sqlTransac As SqlClient.SqlTransaction
Dim sqlCommand As New SqlClient.SqlCommand
OpenConnexionSQL()
sqlTransac = sqlConnexion.BeginTransaction("UpdateASSOCIATE")
Try
With sqlCommand
.Connection = sqlConnexion
.Transaction = sqlTransac
.Parameters.AddWithValue("@AncCodeSabam", AncienCodeSabam.Trim.ToString)
.Parameters.AddWithValue("@CodeSabam", drAssociate.CodeSabam.ToString)
.Parameters.AddWithValue("@Name", drAssociate.Name.ToString)
.Parameters.AddWithValue("@FirstName", drAssociate.FirstName.ToString)
.Parameters.AddWithValue("@DateOfBirth", CDate(drAssociate.DateOfBirth.ToString))
.Parameters.AddWithValue("@Sex", drAssociate.Sex.ToString)
If drAssociate.IsDateFirstAmountNull Then
.Parameters.AddWithValue("@DateFirstAmount", SqlTypes.SqlDateTime.Null)
Else
.Parameters.AddWithValue("@DateFirstAmount", CDate(drAssociate.DateFirstAmount.ToString).ToString)
End If
If drAssociate.IsDateReportNull Then
.Parameters.AddWithValue("@DateReport", SqlTypes.SqlString.Null)
Else
.Parameters.AddWithValue("@DateReport", CDate(drAssociate.DateReport.ToString).ToString)
End If
.Parameters.AddWithValue("@Type", drAssociate.Type.ToString)
.Parameters.AddWithValue("@Nature", drAssociate.Nature.ToString)
.CommandText = "update ASSOCIATE " & _
"SET CodeSabam = @CodeSabam " & _
",Name = @Name " & _
",FirstName = @FirstName " & _
",DateOfBirth = @DateOfBirth " & _
",sex = @sex " & _
",DateFirstAmount = @DateFirstAmount " & _
",DateReport = @DateReport " & _
",Type = @Type " & _
",Nature = @Nature " & _
"WHERE (CodeSabam = @AncCodeSabam)"
.ExecuteNonQuery() |
Partager