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
|
'on crèe un objet command pour contenir la requète
Dim command As SqlCommand = New SqlCommand("Insert into INTERVENANTE " & _
"(NomInt, PrenomInt, AdresseInt, CPInt, VilleInt, TelFixeInt, TelPortInt," & _
"SecuSocialeInt, DateNaissInt, LieuNaissInt, DateEntrInt, ObsInt )" & _
"VALUES " & _
"(@nom , @prenom, @adresse, @cp, @ville, @tel, @portable, @secu, @datenaiss, @lieunaiss, @dateentree, @obs)")
'Dim command As SqlCommand = New SqlCommand("Insert into INTERVENANTE " & _
' "(NomInt, PrenomInt, AdresseInt, CPInt, VilleInt, TelFixeInt, TelPortInt, SecuSocialeInt )" & _
' "VALUES " & _
' "(@nom , @prenom, @adresse, @cp, @ville, @tel, @portable, @secu)")
'on affecte aux paramètres de la requète les données à insérer
command.Parameters.Add(New SqlParameter("@nom", SqlDbType.Text, 50))
command.Parameters("@nom").Value = TXTnomnvint.Text
command.Parameters.Add(New SqlParameter("@prenom", SqlDbType.Text, 50))
command.Parameters("@prenom").Value = TXTprenomnvint.Text
command.Parameters.Add(New SqlParameter("@adresse", SqlDbType.Text, 50))
command.Parameters("@adresse").Value = TXTadrnvint.Text
command.Parameters.Add(New SqlParameter("@cp", SqlDbType.Int, 6))
command.Parameters("@cp").Value = Int(Val(TXTcpnvint.Text))
command.Parameters.Add(New SqlParameter("@ville", SqlDbType.Text, 30))
command.Parameters("@ville").Value = TXTvillenvint.Text
command.Parameters.Add(New SqlParameter("@tel", SqlDbType.Int, 10))
command.Parameters("@tel").Value = Int(Val(TXTtelnvint.Text))
command.Parameters.Add(New SqlParameter("@portable", SqlDbType.Int, 10))
command.Parameters("@portable").Value = Int(Val(TXTportnvint.Text))
command.Parameters.Add(New SqlParameter("@secu", SqlDbType.Float, 15))
command.Parameters("@secu").Value = (TXTsecunvint.Text)
command.Parameters.Add(New SqlParameter("@datenaiss", SqlDbType.SmallDateTime, 15))
command.Parameters("@datenaiss").Value = Format(CType(Datenaissnvint.Text, Date), "dd/MM/yyyy") |
Partager