Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Startup Page Form
- Imports System.Data.SqlClient
- Imports System.Media
- Public Class frmStartupPage
- Inherits System.Windows.Forms.Form
- Public myConn As SqlConnection
- Public myCmd As SqlCommand
- Public myReader As SqlDataReader
- Public results As String
- myConn = New SqlConnection("Initial Catalog=Design_Media_Institution;Data Source=DESKTOP-D9KB02PSQLEXPRESS;Integrated Security=SSPI;")
- Private Sub frmStartupPage_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
- e.Graphics.DrawLine(Pens.Black, New Point(442, 100), New Point(442, 494))
- End Sub
- Public Sub btnUserLogin_Click(sender As Object, e As EventArgs) Handles btnUserLogin.Click
- Try
- myCmd = myConn.CreateCommand
- myCmd.CommandText = "SELECT * FROM User_Info WHERE Username ='" & txtUserName.Text & "' AND Password ='" & txtUserPassword.Text & "' "
- myConn.Open()
- myReader = myCmd.ExecuteReader()
- If (myReader.Read() = True) Then
- frmUserProfile.Show()
- Me.Hide()
- ElseIf txtUserName.Text = "" Or txtUserPassword.Text = "" Then
- MsgBox("Incomplete details !")
- Else
- MsgBox("Incorrect details !")
- End If
- myReader.Close()
- Catch ex As Exception
- MsgBox("An error occurred: " & ex.Message)
- Finally
- myConn.Close()
- End Try
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement