My login system used a database1.mdf and if the user is new to the program it will have a default login, if signed in with the default login then user will be promoted to a firstrun.vb screen which will allow the them to change username and password or else it will go to the mainmenu.
Problem : I am unsure how to stop the firstrun form from appearing if the user as already changed the password or username, either 1. and what code to add to the form firstrun.vb if they would like to change it, meaning updating the database.mdf.
Anymore information if needed please qoute me.
Code:Imports System.Data.SqlClient Public Class Login Dim cm As SqlConnection Dim dr As SqlDataReader Dim cmd As SqlCommand Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim dr1 As SqlDataReader Dim cmd1 As SqlCommand Dim Username As String Dim Password As String cm = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Login.mdf;Integrated Security=True;User Instance=True") cm.Open() cmd = New SqlCommand("SELECT Username FROM UserPass", cm) dr = cmd.ExecuteReader dr.Read() Username = dr(0) cm.Close() cm.Open() cmd = New SqlCommand("SELECT Password FROM UserPass", cm) dr = cmd.ExecuteReader dr.Read() Password = dr(0) If Password = "Default" And Username = "Default" Then Me.Hide() FirstRun.Show() End If If Username <> "Default" Or Password <> "Default" Then MsgBox("Incorrect Login", MsgBoxStyle.Exclamation) ElseIf Password <> "Default" And Username <> "Default" Then End If End Sub




Reply With Quote
