paradize99
Messages postés11Date d'inscriptionvendredi 22 mars 2019StatutMembreDernière intervention22 mai 2019
-
13 mai 2019 à 18:11
paradize99
Messages postés11Date d'inscriptionvendredi 22 mars 2019StatutMembreDernière intervention22 mai 2019
-
22 mai 2019 à 14:24
Bonjour,
Ce ne sont pas les premieres requetes je que realise mais la rien ne marche.
Malgre mes essais, mon code n'a pas d'erreur mais quand je vais voir dans ma database la table n'est pas à jour
Si quelqu'un a une idee, merci d'avance pour les reponses
Update command
cn.Open() Dim test As String = "UPDATE tblToolRequisition SET ToolNotes=@ToolNotes , EngineeringNotes=@EngineeringNotes, ProductionNotes=@ProductionNotes where RequistionNum=@RequisitionNum AND PN=@PN AND ToolDRG=@ToolDRG " Dim Update As New OleDbCommand(test, cn)
With Update.Parameters .AddWithValue("@ToolNotes", TextBox1.Text) .AddWithValue("@EngineeringNotes", TextBox2.Text) .AddWithValue("@ProductionNotes", TextBox3.Text) .AddWithValue("@RequisitionNum", TextBox4.Text) .AddWithValue("@PN", TextBox5.Text) .AddWithValue("@ToolDRG", TextBox6.Text) End With
For Each Parameter As OleDbParameter In Update.Parameters If Parameter.Value Is Nothing Then Parameter.Value = DBNull.Value End If Next
Update.ExecuteNonQuery()
Insert command
cn.Open() Dim test As String = "INSERT INTO tblToolRequisition([DeptName], [ReqDate], [RequistionNum], [PN], [Description], [CustomerName], [ToolRev], [ORDNO], [Quantity], [RequiredBy], [ToolNotes], [Operation]) " & "VALUES @DeptName, @ReqDate, @RequisitionNum, @PN, @Description, @Customer, @ToolRev, @ORDNO, @Quantity, @RequiredBy, @ToolNotes, @Operation"
Dim cmd As New OleDbCommand(test, cn)
With cmd.Parameters .AddWithValue("@DeptName", cmbDept.Text) .AddWithValue("@ReqDate", txtDateNow.Text) .AddWithValue("@RequisitionNum", txtID.Text) .AddWithValue("@PN", cmbPN.Text) .AddWithValue("@Description", txtDesc.Text) .AddWithValue("@Customer", txtCustomer.Text) .AddWithValue("@ToolRev", txtRev.Text) .AddWithValue("@ORDNO", cmbORDNO.Text) .AddWithValue("@Quantity", txtQty.Text) .AddWithValue("@RequiredBy", DateTimePicker2.Text) .AddWithValue("@ToolNotes", txtToolDesc.Text) .AddWithValue("@Operation", cmbOper.Text) End With
For Each Parameter As OleDbParameter In cmd.Parameters If Parameter.Value Is Nothing Then Parameter.Value = DBNull.Value End If Next
paradize99
Messages postés11Date d'inscriptionvendredi 22 mars 2019StatutMembreDernière intervention22 mai 2019 22 mai 2019 à 14:24
Bonjour,
C'est vraiment bizarre mais en recreant tout le form et en copiant collant pas a pas tout mon code, les 2 requetes fonctionnent alors que le code n'a pas changé
Je sais vraiment pas comment mais ca marche
Merci quand meme pour ta reponse Nardo26