Request for OleDbPermission failed

Hello Coders.

Im trying to design a login form for a VB.Net 2005 project and im running into some problems along the way.  I am reading data from a locally-stored Access 2003 database.  Below is the sample code.

Private Sub cmdLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Handles cmdLogin.Click
        Dim UserName As String
        Dim Password As String
        UserName = txtUserName.Text
        Password = txtPassword.Text
        Dim myConnection As New OleDb.OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0;Data Source = C:\Documents and Settings\dfranczyk\Desktop\PrecisionSecurity.mdb")
        Dim drUserID As OleDb.OleDbDataReader
        Dim insertCmd As New OleDb.OleDbCommand("Select * From Employee Where UserID= '" & UserName _
                            & "' AND Password = '" & Password & "'", myConnection)

            drUserID = insertCmd.ExecuteReader()

            While drUserID.Read
                MsgBox("Validated!", MsgBoxStyle.OkOnly, "Success")

            End While
        Catch ex As OleDb.OleDbException
            MsgBox("Test Failed", MsgBoxStyle.OkOnly)


        End Try

    End Sub

When I try to run the above code, I get an error on this statement:


Here is the error message:

Request for the permission of type 'System.Data.OleDb.OleDbPermission, System.Data, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.

Any idea of what I am doing wrong?  Any advice or suggestions would be greatly appreciated.  Thanks for your time.
gwosgoodIT MgrAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Joel CoehoornDirector of Information TechnologyCommented:
It's a 'trust' issue with the .Net framework.  This can happen for a number of reasons.  A few of the more common are not getting the correct trust level in your project settings, or running the program from a shared/network folder or drive.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.