1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| Public Sub insererBDD_EPI(ByVal NomEntreprise As String, ByVal type As String, ByVal norme As String, ByVal marque As String, ByVal modele As String, ByVal NumMarquage As String, ByVal annee As String, ByVal dureedevie As String, ByVal resultat As String, ByVal observation As String)
' connexion
Dim cn As New OleDbConnection
cn = connexionBDD()
' generer le code
Dim cmdcount As New OleDbCommand
cmdcount.CommandText = " select count(epi_code) from epi where ent_nom ='" & NomEntreprise & "'"
cmdcount.Connection = cn
cmdcount.Connection.Open()
Dim nb As Integer
nb = cmdcount.ExecuteNonQuery
cmdcount.Connection.Close()
Dim code As String = nb + 1
'insertion
Dim cmd As New OleDbCommand
cmd.CommandText = " Insert into EPI (ent_nom,epi_code,epi_type,epi_norme,epi_marque,epi_modele,epi_NumMarquage,epi_AnneeMarquage,epi_dureedevie,epi_resultat,epi_obsevation) values (' " & NomEntreprise & "','" & code & "','" & type & "','" & norme & "','" & marque & "','" & modele & "','" & NumMarquage & "','" & annee & "','" & dureedevie & "','" & resultat & "','" & observation & "')"
cmd.Connection = cn
cmd.Connection.Open()
cmd.ExecuteNonQuery()
cmd.Connection.Close()
End Sub |
Partager