Question:

Can anyone help me?? i wanted to make the program so that different user will log in to a different form..

by  |  earlier

0 LIKES UnLike

This is the VB program

Imports System.Data.OleDb

Imports System.data

Public Class Form1

Inherits System.Windows.Forms.Form

Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click

Dim cnnstr As String

Dim mycnn As OleDbConnection

Dim myDbAdt As OleDbDataAdapter

Dim myDataSet As DataSet

Dim row As Integer

Dim counter As Integer

Dim uname As String

Dim upassword As String

Dim loginstatus As Integer

Dim adpStr = "Select * from Staff"

cnnstr = "Provider=SQLOLEDB;" & _

"Data Source=ABC\SQLEXPRESS;" & _

"Initial Catalog= XYZ;" & _

"Integrated Security=SSPI;" & _

"uid=;pwd=;"

mycnn = New OleDbConnection(cnnstr)

myDbAdt = New OleDbDataAdapter(adpStr, mycnn)

myDataSet = New DataSet

Try

myDbAdt.Fill(myDataSet, "SID")

Catch ex As Exception

MsgBox(ex.Message)

End Try

Try

row = myDataSet.Tables("SID").Rows.Count

Catch ex As Exception

MsgBox(ex.Message)

End Try

loginstatus = 0

For counter = 0 To row - 1

uname = myDataSet.Tables("SID").Rows(counter).It...

upassword = myDataSet.Tables("SID").Rows(counter).It...

If uname = Trim(UseIDTextBox.Text) And upassword = Trim(PasswordTextBox.Text) = True Then

loginstatus = 1

Exit For

End If

Next

If loginstatus = 1 Then

MsgBox("Login Sucesssfully")

Dim theForm As New Form4()

theForm.ShowDialog()

Else

MsgBox("Login Failed")

End If

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub UseIDTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UseIDTextBox.TextChanged

End Sub

Private Sub rbtnOperator_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnOperator.CheckedChanged

End Sub

Private Sub rbtnManager_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnManager.CheckedChanged

End Sub

Private Sub rbtnAdmin_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rbtnAdmin.CheckedChanged

End Sub

Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click

End Sub

Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click

End Sub

Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

End Sub

Private Sub PasswordTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasswordTextBox.TextChanged

End Sub

End Class

This is our database

create table Staff ( SID varchar (10) not null, SNAME varchar (15), SPOSTION varchar (30), SPASSWORD varchar (10), privilege char (1))

insert into Staff (SID, SNAME, SPOSTION, SPASSWORD, privilege) values

('02535','David','Restaurant Operatior','55588','0')

insert into Staff (SID, SNAME, SPOSTION, SPASSWORD, privilege) values

('02757','Clara','Restaurant Operatior','84334','0')

insert into Staff (SID, SNAME, SPOSTION, SPASSWORD, privilege) values

('02220','John','Restaurant Manager','87878','1')

insert into Staff (SID, SNAME, SPOSTION, SPASSWORD, privilege) values

('02445','Alvin','System Adminstrator','99902','2')

select*from Staff

alter table Staff

add constraint pk_SID primary key (SID)

 Tags:

   Report

1 ANSWERS


  1. Please describe where the problem is occurring, I'm not going to troubleshoot your entire code without knowing where it might be at.

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.
Unanswered Questions