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 30 31 32
| Imports System.Data.Sql
Imports System.Data.SqlClient
Public Class Form1
Dim Conn As SqlConnection
Dim Cmd As SqlCommand
Dim Rd As SqlDataReader
Dim Query As String
Private Sub ButtonMembres_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonMembres.Click
Conn = New SqlConnection("Server=127.0.0.1;Database=PS_DATABASE;User Id=/;Password=/")
Try
If TextPSN.Text = "" Then
MessageBox.Show("Le champ PSN ne doit pas être vide.")
End If
If TextMDP.Text = "" Then
MessageBox.Show("Le champ Mot de passe ne doit pas être vide.")
End If
Conn.Open()
Query = "Select * from PS_Database.dbo.Login where PSN = '" & TextPSN.Text & "' and Motdepasse = '" & TextMDP.Text & "'"
Cmd = New SqlCommand(Query, Conn)
Rd = Cmd.ExecuteReader
MessageBox.Show("Connexion Réusite!")
Conn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
Conn.Dispose()
End Try
End Sub
End Class |