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

Data Source Localhost Initial Catalog Personne Integrated Security True

This code connects to a SQL database to retrieve data on stylists and costumes. It loads the data into a data grid view called "liste_s_c" on form load and when a refresh button is clicked. It also passes the selected row data to another form when a modify button is clicked.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views1 page

Data Source Localhost Initial Catalog Personne Integrated Security True

This code connects to a SQL database to retrieve data on stylists and costumes. It loads the data into a data grid view called "liste_s_c" on form load and when a refresh button is clicked. It also passes the selected row data to another form when a modify button is clicked.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Remarque : liste_s_c : est une datagridview

Imports System.Data
Imports System.Data.SqlClient
Public Class Form1
Dim cnx As New SqlConnection("data source=localhost;initial
catalog=Personne;integrated security=true;")
Private Function listestyliste() As DataTable
Dim table As New DataTable
Dim cmd As New SqlCommand("Select s.nomstyliste,c.designationcostume
from styliste s , costume c where s.numstyliste=c.numstyliste", cnx)
Try
table.Load(cmd.ExecuteReader)
Catch ex As Exception
MsgBox(ex.Message)
End Try

Return table
End Function

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles MyBase.Load
Try
cnx.Open()
liste_s_c.DataSource = listestyliste()
Catch ex As Exception
MsgBox(ex.Message)
End Try

End Sub

Private Sub actualiser_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles actualiser.Click
liste_s_c.DataSource = listestyliste()
End Sub

Private Sub modifier_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles modifier.Click
Form2.Show()
Form2.nom.Text = liste_s_c.CurrentRow.Cells(0).Value
Form2.adresse.Text = liste_s_c.CurrentRow.Cells(1).Value

End Sub
End Class

You might also like