Figured it out here is the updated code for anyone interested.
Partial Class Login
Inherits System.Web.UI.Page
Dim TestFeed As New Label
#Region "Code Fired when Button Okay is clicked"
Protected Sub btnOk_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOk.Click
If ValidateUser(Username.Text, Password.Text) = True Then
FormsAuthentication.RedirectFromLoginPage(Username.Text, False)
FeedBack.Visible = True
FeedBack.Text = "You are now authorized please click the link below to proceed"
'MainPageLink.Visible = True
Else
FeedBack.Visible = True
FeedBack.Text = "We're sorry, but the information you provided" & _
"does not match our database. Please try again."
End If
End Sub
#End Region
#Region "ValidateUser Function"
'Version 1.0.1 By Tony Stegall
'Function: Return Boolean if user is an authorized user
'PreCondition: User is not logged in and trying to access restricted page
'User must enter username and password in form
'PostCondition: Sql query ran based on supplied userid parameter
'True returned if user is authorized, False if not
Protected Function ValidateUser(ByVal uid As String, ByVal pwd As String) As Boolean
Dim blnValidUser As Boolean 'use to determine if user is valid or not
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\Documents and Settings\\tony.TONYWIN\\My Documents\\Visual Studio 2005\\WebSites\\PedalValveExpense\\pvidb.mdb;User Id=admin;Password=;"
Dim MySQL As String = "Select userID,BeginDate, ExpenseID from ExpenseReport where userID=@uid"
Dim MyConn As New System.Data.OleDb.OleDbConnection(strConn) 'makes a connection to the database based on connection string
Dim objDR As System.Data.OleDb.OleDbDataReader 'reads the values into memory to reduce server overhead
Dim Cmd As New System.Data.OleDb.OleDbCommand(MySQL, MyConn) 'executes the actual command to connect to the database
Cmd.Parameters.Add(New System.Data.OleDb.OleDbParameter("@userID", uid)) 'sets up a parameter of userID in the cookie with the userID its encypted by default
MyConn.Open() ' opens the database connection
objDR = Cmd.ExecuteReader() ' executes a commmand that actually reads thru the database
Try ' We don't want error out there that would possibly show the user our database struct
' s