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
| Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Try
systRequete = "select * from système where libellé = '" & ComboBox1.Text & "'"
userRequete = "select * from authentification where login ='" & nomUser & "'"
strRequete = "insert into incident(id_systeme, date_incident, heure_incident, agence, users_concernés, id_user_declare, état_résolution, composante_concernée) values (" & idSys & ", " & DateTimePicker1.Value & ", " & MaskedTextBox1.Text & ", " & ComboBox2.Text & ", " & TextBox1.Text & ", " & idUser & ", 'non résolu', " & TextBox2.Text & ")"
Dim oConnexion As New SqlConnection(strConnexion)
Dim oCommandSys As New SqlCommand(systRequete, oConnexion)
Dim oCommandUser As New SqlCommand(userRequete, oConnexion)
Dim oCommand As New SqlCommand(strRequete, oConnexion)
oConnexion.Open()
Dim oReader As SqlDataReader = oCommandSys.ExecuteReader()
While oReader.Read()
idSys = oReader.GetValue(0)
End While
oReader.Close()
Dim ooReader As SqlDataReader = oCommandUser.ExecuteReader()
While ooReader.Read()
idUser = ooReader.GetValue(0)
End While
ooReader.Close()
oCommand.ExecuteNonQuery()
oConnexion.Close()
Catch ex As Exception
MsgBox("erreur: " & ex.Message)
End Try |
Partager