Next Chapter 44 Login Form

PROJECT SOURCE CODE

SPONSORED LINKS

Login Form

Dim Check As Integer

Private Sub Command1_Click()

On Error GoTo ErHand

With Me

' .Command1.Enabled = False

Set Conn = New ADODB.Connection

ConnectionString = "Provider=SQLOLEDB.1;Password=" & .txtPassword & ";Persist Security Info=True;User ID=" & .TxtUser & ";Initial Catalog=" & .TxtDatabase & ";Data Source=" & .TxtServer & " "

Conn.Open ConnectionString

ServerName = .TxtServer.Text

UserName = .TxtUser.Text

Password = .txtPassword.Text

Call SaveSetting(App.Title, "UserEntry", "UserName", .TxtUser)

Call SaveSetting(App.Title, "UserEntry", "ServerName", .TxtServer)

Call SaveSetting(App.Title, "UserEntry", "DatabaseName", .TxtDatabase.Text)

Unload Me

CreateUserFrm.Show

End With

Exit Sub

ErHand:

MsgBox "Unable To Connect To Database......" & vbCrLf & err.Description, vbCritical + vbDefaultButton1, "Invalid Information"

Command1.Enabled = True

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

Private Sub Form_Load()

On Error GoTo ErrHandler:

With Me

.TxtUser = GetSetting(App.Title, "UserEntry", "UserName", "")

.TxtServer = GetSetting(App.Title, "UserEntry", "ServerName", "")

.TxtDatabase.AddItem GetSetting(App.Title, "UserEntry", "DatabaseName", "")

.TxtDatabase.Text = GetSetting(App.Title, "UserEntry", "DatabaseName", "")

ServerName = IIf(.TxtServer.Text = "", "Anoop", .TxtServer.Text)

UserName = IIf(.TxtUser.Text = "", "samee", .TxtUser.Text)

Password = IIf(.txtPassword.Text = "", "samee", .txtPassword.Text)

Screen.MousePointer = vbHourglass

Set Conn = New ADODB.Connection

ConnectionString = "Provider=SQLOLEDB.1;Password=samee;Persist Security Info=True;User ID=samee;Initial Catalog=" & .TxtDatabase & ";Data Source=" & .TxtServer & " "

Conn.Open ConnectionString

Call GetDatabaseList(TxtDatabase)

.TxtDatabase.AddItem GetSetting(App.Title, "UserEntry", "DatabaseName", "")

.TxtDatabase.AddItem "Master"

Screen.MousePointer = vbDefault

End With

Exit Sub

ErrHandler:

MsgBox "Server Name Not Found....." & vbCrLf & err.Description

err.Clear

If Screen.MousePointer = vbHourglass Then

Screen.MousePointer = vbDefault

End If

End Sub