I'm working on an ASP.NET website where I am using an asp:repeater with paging done through a VB.NET code-behind file. I'm having trouble with the database connection though. As far as I can tell, the paging is working, but I can't get the data to be certain.

The database is a Microsoft Access database. The function that should be accessing the database is:

Dim pagedData As New PagedDataSource

Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
End Sub

Function getTheData() As DataTable
    Dim DS As New DataSet()
    Dim strConnect As New OleDbConnection("Provider = Microsoft.Jet.OLEDB.4.0;Data Source=App_Data/ArtDatabase.mdb")
    Dim objOleDBAdapter As New OleDbDataAdapter("SELECT ArtID, FileLocation, Title, UserName, ArtDate FROM Art ORDER BY Art.ArtDate DESC", strConnect)
    objOleDBAdapter.Fill(DS, "Art")

    Return DS.Tables("Art").Copy
End Function

Sub doPaging()
    pagedData.DataSource = getTheData().DefaultView
    pagedData.AllowPaging = True
    pagedData.PageSize = 2

        pagedData.CurrentPageIndex = Int32.Parse(Request.QueryString("Page")).ToString()
    Catch ex As Exception
        pagedData.CurrentPageIndex = 0
    End Try

    btnPrev.Visible = (Not pagedData.IsFirstPage)
    btnNext.Visible = (Not pagedData.IsLastPage)

    pageNumber.Text = (pagedData.CurrentPageIndex + 1) & " of " & pagedData.PageCount

    ArtRepeater.DataSource = pagedData
End Sub

The ASP.NET is:

<asp:Repeater ID="ArtRepeater" runat="server">
        <h2>Items in Selected Category:</h2>
            <asp:HyperLink runat="server" ID="HyperLink"
                NavigateUrl='<%# Eval("ArtID", "ArtPiece.aspx?ArtID={0}") %>'>
                <img src="<%# Eval("FileLocation") %>"
                    alt="<%# DataBinder.Eval(Container.DataItem, "Title") %>t"/> <br />
                <%# DataBinder.Eval(Container.DataItem, "Title") %>
+1  A: 

If you need help with Connection Strings, this site is the ultimate resource!

That site is great! Thanks

Are you creating the connection string by hand? If so...don't do that! Use the Server Explorer to create your connection. Then highlight it and go to the Properties window, and you'll see the connection string it uses.

Also, using the Server Explorer will let you browse through your tables and even open them up to see your data. At least that'll tell you for certain whether your data is accessible.

I didn't know that! Thanks for that, it doesn't really solve my problem though. Using the connection string it gives me, I still don't have any data displaying though

Problem solved! Pretty much banging my head against the wall now considering how simple it was. It was the Page_Load, I changed it to the following:

Protected Sub Page_Load1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub

And voila, it works!

Also, for the connection string, I ended up using:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\ArtDatabase.mdb

Which works great.

Thanks for your help and input guys!


oledb connection to database