Hi guys just a question? i would like to know how to use the variable 'STATUS' column in my DB into my application. In my application i have an Authentification Menu where i can check the STATUS if the user is connected or not. and get a message.
There is the table in my DB called Authentification with the columns below:
Username,Profil,Password and STATUS.
Below is the Button where i can check the STATUS
Code:
Dim STATUS As String = ""
Dim MyConnexion As SqlConnection = New SqlConnection("Data Source=10.1.1.221,49170;Database=Gestock1;Uid=sa;Pwd=Admin123")
Try
' MyConnexion = New SqlConnection("Data Source=OKOUELE\SQLEXPRESS;Initial Catalog=Gestock;Integrated Security=True")
MyConnexion = New SqlConnection("Data Source=10.1.1.221,49170;Database=Gestock1;Uid=sa;Pwd=xxxxxxx")
If MyConnexion.State <> ConnectionState.Open Then
' MsgBox("Connecté à la base de données SQL")
MyConnexion.Open()
Else
MsgBox("Echec de connection!!!")
End If
Catch ex As DataException
MessageBox.Show(ex.Message)
End Try
TheSqll = " select * from Utilisateurs where Profil = '" & ComboType.Text & "'and Username = '" & TextUsers.Text & "' and Password ='" & TextPass.Text & "'"
If STATUS = "Connecté" Then
MsgBox(" Utilisateur '" & TextUsers.Text & "' déjà connecté ")
ElseIf STATUS = "Déconnecté" Then
MsgBox(" Utilisateur '" & TextUsers.Text & "' non connecté ")
End If
How do i use this variable from my DB into my code???