Login page - MDB no connection RRS feed

  • Question

  • User372570448 posted

    Dear all,

    I am building an application with login page as the landing page. The code below is supposed to retrieve information from an Access database. It will compare user name & password, if true then it will redirect to main page. When testing on localhost machine, the connection is successful. But when testing over a network using other computer, there seems to be no connection but no error. I have set all permission and security in IIS7 accordingly. Appreciate your help and comments. TQ.

            Dim myPath As String
            myPath = Server.MapPath("olps.mdb")
            Dim connString As String
            connString = "Provider=Microsoft.Jet.OLEDB.4.0; Data source=" & myPath & ";"
            Dim objConnection As OleDbConnection
            objConnection = New OleDbConnection(connString)
            'Specify our SQL statement
            Dim strSQL As String = "SELECT Password, Nama FROM Staff WHERE Nama=?"
            'Create the Command object
            Dim objCommand As OleDbCommand
            objCommand = New OleDbCommand(strSQL, objConnection)
            objCommand.Parameters.AddWithValue("?Nama", Trim(txtUserName.Text))
            objConnection.Open()   'open the connection
            Dim strPassword As String = objCommand.ExecuteScalar()
            If strPassword = txtPassword.Text Then
                lblMessage.Text = "Login successful"
                Session("User") = txtUserName.Text
                lblMessage.Text = "Login fail"
            End If

    Monday, April 26, 2010 10:30 PM


All replies