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
|
'Ma requête pour insérer les lignes dans ma bdd
sql_insert = "INSERT INTO mp_ligne_cmd (mp_IdCmd, mp_NoCmd, mp_NomProduit, mp_QTcmd, mp_QTretour, mp_RowGuid, mp_createdBy, mp_dateCreation, mp_modifiedBy, mp_dateModification) VALUES (@mp_IdCmd, @mp_NoCmd, @mp_NomProduit, @mp_QTcmd, @mp_QTretour, @mp_RowGuid, @mp_createdBy, @mp_dateCreation, @mp_modifiedBy, @mp_dateModification)"
'Ma requête pour supprimer les lignes dans ma bdd
sql_delete = "DELETE FROM mp_ligne_cmd WHERE mp_id = @mp_id"
connection = New SqlConnection(connetionString)
Try
connection.Open()
command = New SqlCommand(sql_insert, connection)
adapter.InsertCommand = command
adapter.InsertCommand.Parameters.Add("@mp_IdCmd", SqlDbType.Int).Value = No_Cmde
adapter.InsertCommand.Parameters.Add("mp_NoCmd", SqlDbType.NVarChar, 50, "mp_NoCmd")
adapter.InsertCommand.Parameters.Add("mp_NomProduit", SqlDbType.NVarChar, 50, "mp_NomProduit")
adapter.InsertCommand.Parameters.Add("@mp_QTcmd", SqlDbType.Int, 999, "mp_QTcmd")
adapter.InsertCommand.Parameters.Add("@mp_QTretour", SqlDbType.Int, 999, "mp_QTretour")
adapter.InsertCommand.Parameters.Add("@mp_RowGuid", SqlDbType.NVarChar, 999, "mp_RowGuid")
adapter.InsertCommand.Parameters.Add("@mp_createdBy", SqlDbType.NVarChar, 50, "mp_createdBy")
adapter.InsertCommand.Parameters.Add("@mp_dateCreation", SqlDbType.DateTime).Value = Now
adapter.InsertCommand.Parameters.Add("@mp_modifiedBy", SqlDbType.NVarChar, 50, "mp_modifiedBy")
adapter.InsertCommand.Parameters.Add("@mp_dateModification", SqlDbType.DateTime).Value = Now
command = New SqlCommand(sql_delete, connection)
adapter.DeleteCommand = command
adapter.DeleteCommand.Parameters.Add("@mp_id", SqlDbType.Int).Value = CType(Session("mp_ligne_supp"), Integer)
adapter.Update(ds, "Table")
ds.Clear()
adapter.Dispose()
command.Dispose()
connection.Close()
Label1.Text = "Modifications mises à jour!" |
Partager