[go: up one dir, main page]

0% found this document useful (0 votes)
21 views1 page

Imports System - Data.SqlClient

The document is a Visual Basic .NET code for a form that manages service entries in a database. It includes functionality to enable a save button when text is entered, handle the saving of service data to a SQL database, and provide user feedback upon successful entry. The form also allows for returning to the previous state by disposing of the current form.

Uploaded by

branhamkamte137
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views1 page

Imports System - Data.SqlClient

The document is a Visual Basic .NET code for a form that manages service entries in a database. It includes functionality to enable a save button when text is entered, handle the saving of service data to a SQL database, and provide user feedback upon successful entry. The form also allows for returning to the previous state by disposing of the current form.

Uploaded by

branhamkamte137
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Imports System.Data.

SqlClient

Public Class form_service

Private Sub Btn_RETOUR_Click(sender As Object, e As EventArgs) Handles


Btn_RETOUR.Click
Me.Dispose()
End Sub

Private Sub Text_service_Textchanged(sender As Object, e As EventArgs) Handles


Text_service.TextChanged
If Text_service.Text <> "" Then
Btn_ENREGISTRE.Enabled = True
Else
Btn_ENREGISTRE.Enabled = False
End If

End Sub

Private Sub Btn_ENREGISTRE_Click(sender As Object, e As EventArgs) Handles


Btn_ENREGISTRE.Click
Dim cn As New SqlConnection
Dim cmd As New SqlCommand
cn.ConnectionString = "server=localhost; userid=root; password=root;
database=gesper_db; sslmode=none"
cn.Open()
cmd.Connection = cn
cmd.CommandText = " insert into gesper_db.servive (code service, Nom
service) values ('" & TextBox1.Text & "','" & Text_service.Text & "')"
cmd.ExecuteNonQuery()
MsgBox(" service enregistrees avec succes", MsgBoxStyle.Information, "
Enregistrement")
TextBox1.Text = ""
Text_service.Text = ""
TextBox1.Focus()

End Sub

Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click

End Sub
End Class

You might also like