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
|
Imports System.Data
Imports System.Data.SqlClient
Public Class gestion
Dim sql As String
Dim conn As String
Dim con As SqlConnection = New SqlConnection("Data Source=HP-PC;Initial Catalog=base;Integrated Security=True")
Dim cmd As SqlCommand
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
con.Open()
sql = "insert into [table] values('" & TextBox5.Text & "','" & TextBox4.Text & "','" & ComboBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox1.Text & "')"
cmd = New SqlCommand(sql, con)
cmd.CommandType = CommandType.Text
con.Close()
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox5.Clear()
End Sub |
Partager