Advertisement
Guest User

Untitled

a guest
Oct 6th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. ' Startup Page Form
  2. Imports System.Data.SqlClient
  3. Imports System.Media
  4. Public Class frmStartupPage
  5. Inherits System.Windows.Forms.Form
  6.  
  7. Public myConn As SqlConnection
  8. Public myCmd As SqlCommand
  9. Public myReader As SqlDataReader
  10. Public results As String
  11. myConn = New SqlConnection("Initial Catalog=Design_Media_Institution;Data Source=DESKTOP-D9KB02PSQLEXPRESS;Integrated Security=SSPI;")
  12.  
  13. Private Sub frmStartupPage_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
  14. e.Graphics.DrawLine(Pens.Black, New Point(442, 100), New Point(442, 494))
  15. End Sub
  16.  
  17. Public Sub btnUserLogin_Click(sender As Object, e As EventArgs) Handles btnUserLogin.Click
  18. Try
  19. myCmd = myConn.CreateCommand
  20. myCmd.CommandText = "SELECT * FROM User_Info WHERE Username ='" & txtUserName.Text & "' AND Password ='" & txtUserPassword.Text & "' "
  21. myConn.Open()
  22. myReader = myCmd.ExecuteReader()
  23. If (myReader.Read() = True) Then
  24. frmUserProfile.Show()
  25. Me.Hide()
  26. ElseIf txtUserName.Text = "" Or txtUserPassword.Text = "" Then
  27. MsgBox("Incomplete details !")
  28. Else
  29. MsgBox("Incorrect details !")
  30. End If
  31. myReader.Close()
  32. Catch ex As Exception
  33. MsgBox("An error occurred: " & ex.Message)
  34. Finally
  35. myConn.Close()
  36. End Try
  37. End Sub
  38. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement