what is wrong with the below function RRS feed

  • Question

  • User1051635487 posted

    My aspx page is






    and my function is

    Function GettxtR()

       'Dim sConnString, sSQL As String

                'Dim ranInt As Integer

                'ranInt = Int((4 * Rnd()) + 1)

                'Dim txtR As String = ""

                'sConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\TestData.mdb"


                'sSQL = "SELECT * FROM test where ID=" & ranInt

                'Dim conn As New System.Data.OleDb.OleDbConnection(sConnString)
                'Dim cmd As New System.Data.OleDb.OleDbCommand(sSQL, conn)
                'Dim dr As System.Data.OleDb.OleDbDataReader
                'Dim title As String

                'dr = cmd.ExecuteReader()

                'Do While dr.Read()
                '    title = dr.Item("title")
                '    txtR = "<table><tr><td valign=""top"">
       '    txtR="HELLOHELLO"
                '    txtR &= "</td></tr></table>"

       return txtR
       End Function


    If I dont comment out this function my page is paling saying that

    The Microsoft Jet database engine cannot open the file 'testdata.mdb'. It is already opened exclusively by another user, or you need permission to view its data.Thanks,


    Thursday, January 7, 2010 10:15 AM


  • User1051635487 posted

    I got this resolved by setting the impersonate=true in the web.config and adding the username and password 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, January 7, 2010 12:56 PM

All replies