Advertisement
Guest User

Untitled

a guest
Mar 13th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. Imports System.Boolean
  2.  
  3. Imports System.Data.SqlClient
  4.  
  5. Public Class Form1
  6.  
  7. Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  8.  
  9. End Sub
  10.  
  11. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  12. Dim username As String
  13. Dim pswd As String
  14. Dim conn As SqlConnection
  15. Dim cmd As SqlCommand
  16. Dim reader As SqlDataReader
  17.  
  18. username = txt_username.Text
  19. pswd = txt_password.Text
  20. txt_username.Text = Focus()
  21. txt_password.Visible = "False"
  22. Try
  23. conn = New SqlConnection("data source=TAMIZHANSQLEXPRESS;persistsecurity info=False;initial catalog=log;User ID=sa;Password=123");
  24. cmd = New SqlCommand("Select usename,passw from Userlog where usename='" + username + "' & passw='" + pswd + "'")
  25. conn.Open()
  26. reader = cmd.ExecuteReader()
  27. If (String.Compare(pswd and '"+passw+"')) Then
  28. MsgBox("Success")
  29. End If
  30. If (reader.Read()) Then
  31.  
  32. MsgBox("Login success")
  33.  
  34. End If
  35. conn.Close()
  36. Catch ex As Exception
  37. MsgBox("Error"+ex.Message());
  38. End Try
  39. End Sub
  40. End Class
  41.  
  42. If (String.Compare(pswd,passw) = 0) Then
  43. MsgBox("Success")
  44. End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement