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
| Imports System.Data.SqlClient
Public Class Form2
Dim strSQL As String
Dim MaConnection As New SqlConnection()
Dim MaRequete As New SqlCommand
Dim Commande As New SqlCommand
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
MaConnection.ConnectionString = "server=127.0.0.1;User Id=root;database=copro"
If MaConnection.State = ConnectionState.Closed Then
MaConnection.Open()
End If
End Sub
Private Sub BtnQuitter_Click(sender As Object, e As EventArgs) Handles BtnQuitter.Click
End
End Sub
Private Sub BtnAjouter_Click(sender As Object, e As EventArgs) Handles BtnAjouter.Click
MaRequete.Connection = MaConnection
MaRequete.CommandType = CommandType.Text
Commande.CommandText = "INSERT INTO Entreprise (raisonSoc,adresse,tel,codePos,ville) VALUES ('" & TbNom.Text & "','" & TbAdresse.Text & "','" & TbVille.Text & "','" & TbCdp.Text & "','" & TbTel.Text & "') ;"
MaConnection.Close()
End Sub
Private Sub TbAdresse_TextChanged(sender As Object, e As EventArgs) Handles TbAdresse.TextChanged
End Sub
End Class |
Partager