| 12
 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
 
 |  
Private Sub Button2_Click(ByVal sender AS System.Object, ByVal e AS System.EventArgs) Handles Button2.Click
        IF NOT (TextBox1.Text = "") AND NOT (TextBox2.Text = "") AND NOT (TextBox4.Text = "") Then
 
 
            Dim strsql AS String = "Select * from responsable"
            Dim strConnexion AS String = "Persist Security Info=true;Integrated Security=SSPI;database=parc municipal;server=USER-PC\AHMED"
            Dim x AS Exception
 
                Dim oConnection AS New SqlConnection(strConnexion)
                oConnection.Open()
                Dim ObjetDA AS New SqlDataAdapter(strsql, oConnection)
                ObjetDA.Fill(Parc_municipalDataSet1, "responsable")
                ObjetDA.InsertCommand = New SqlCommand("INSERT INTO responsable(num_matricule,nom_prenom, titre) Values(@num_matricule,@nom_prenom,@titre)", oConnection)
                ObjetDA.InsertCommand.Parameters.ADD("@num_matricule", SqlDbType.Int, 15, "num_matricule")
                ObjetDA.InsertCommand.Parameters.ADD("@nom_prenom", SqlDbType.NVarChar, 15, "nom_prenom")
                ObjetDA.InsertCommand.Parameters.ADD("@titre", SqlDbType.NVarChar, 15, "titre")
 
 
 
                Dim DR AS DataRow
                DR = Parc_municipalDataSet1.TABLES("responsable").NewRow
                DR("num_matricule") = TextBox1.Text
                DR("titre") = TextBox4.Text
                DR("nom_prenom") = TextBox2.Text
                Parc_municipalDataSet1.TABLES("responsable").Rows.ADD(DR)
                ObjetDA.UPDATE(Parc_municipalDataSet1, "responsable")
                Parc_municipalDataSet1.Clear()
                ObjetDA.Fill(Parc_municipalDataSet1, "responsable")
 
                Parc_municipalDataSet1.concerner_r.Constraints.ADD("FK_concerner_r_responsable", Parc_municipalDataSet1.responsable.COLUMNS("num_matricule"), Parc_municipalDataSet1.concerner_r.COLUMNS("num_matricule"))
                Parc_municipalDataSet1.concerner_r.Constraints.ADD("FK_concerner_r_categorie", Parc_municipalDataSet1.categorie.COLUMNS("nom_cat"), Parc_municipalDataSet1.concerner_r.COLUMNS("nom_cat"))
 
 
 
                Dim DR1 AS DataRow
                DR1 = Parc_municipalDataSet1.TABLES("concerner_r").NewRow
                DR1("num_matricule") = TextBox1.Text
                DR1("nom_cat") = ComboBox1.SelectedItem.ToString
                Parc_municipalDataSet1.TABLES("concerner_r").Rows.ADD(DR1)
                ObjetDA.UPDATE(Parc_municipalDataSet1, "concerner_r")
                Parc_municipalDataSet1.Clear()
                ObjetDA.Fill(Parc_municipalDataSet1, "concerner_r") | 
Partager