Getting SQL Data

  • Thread starter Thread starter AbanoubZak
  • Start date Start date
A

AbanoubZak

Guest
Hello,

I have a question i'm making a login form for my application and i'm using sql server as user DB

i'm using this code to create a connection between my app and sql server db and it works find.


Dim sql As String = "select count(*) from LoginUsers where Username=@Username and Password=@Password"
Using Conn As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("AZFTS.My.MySettings.AZFTSACCConnectionString").ConnectionString)
Using cmd As New SqlCommand(sql, Conn)
Conn.Open()
cmd.Parameters.AddWithValue("@UserName", usertext.Text)
cmd.Parameters.AddWithValue("@Password", passtext.Text)

Dim value = cmd.ExecuteScalar()
If (value > 0) Then
Me.Hide()
Main.Show()
Main.UsernameLabel1.Text = usertext.Text


' here i need to make lable in main form read user type as like admin or user'

'Main.UsertypeLabel1.text= ...............



MessageBox.Show("Login sucessfully as")

Else
MessageBox.Show("Invalid User or Password!")
End If
End Using



so i need to display the user type from the same table which been used to login on "Main.UsertypeLabel1"

the Cell name in sql DB is Usertype

______________________________________

Thanks in advance.

Continue reading...
 
Back
Top