Access DataSource in code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • eselk2003@gmail.com

    Access DataSource in code

    I'm just starting out with VWD 2008, and new to ASP .NET.

    I have a master page which displays one record for an Access database
    based on an ID number in the query string. Then I have a content page
    that displays some other records which are also filtered by that ID.
    I'd like to do just one query in the master page, which returns all
    fields for that main record, then just use those fields in the details
    page instead of doing a seperate query.

    On the master page I currently have a DetailsView, hooked to an
    ObjectDataSourc e, hooked to a TableAdapter for the Access table that
    has the main record I'm displaying details for on the master page.
    The query in the TableAdapter returns all rows "select *" even though
    I only show some in the DetailsView... so can I (and how) access that
    data in one or more content pages? As of now I don't even know how to
    access the data in the master page, because I don't see any properties/
    methods of ObjectDataSourc e that return anything with "Rows" and
    "Fields".
  • Stan

    #2
    Re: Access DataSource in code

    On 28 May, 00:42, eselk2...@gmail .com wrote:
    I'm just starting out with VWD 2008, and new to ASP .NET.
    >
    I have a master page which displays one record for an Access database
    based on an ID number in the query string.  Then I have a content page
    that displays some other records which are also filtered by that ID.
    I'd like to do just one query in the master page, which returns all
    fields for that main record, then just use those fields in the details
    page instead of doing a seperate query.
    >
    On the master page I currently have a DetailsView, hooked to an
    ObjectDataSourc e, hooked to a TableAdapter for the Access table that
    has the main record I'm displaying details for on the master page.
    The query in the TableAdapter returns all rows "select *" even though
    I only show some in the DetailsView... so can I (and how) access that
    data in one or more content pages?  As of now I don't even know how to
    access the data in the master page, because I don't see any properties/
    methods of ObjectDataSourc e that return anything with "Rows" and
    "Fields".
    Hi

    If I understand you correctly you want to know how to get the Master
    page within scope of the content page?

    In the source code (.aspx file) of the content page you need to add a
    line at the top beneath the @page directive something like this:
    <%@ MasterType virtualpath=" (path to your master page) " %>

    You will then find that an object named Master becomes accessible
    including any properties, variable declarations or procedures/
    functions with a public attribute, from within the content page.

    Comment

    • eselk2003@gmail.com

      #3
      Re: Access DataSource in code

      On May 27, 7:41 pm, Stan <googles...@phi lhall.netwrote:
      If I understand you correctly you want to know how to get the Master
      page within scope of the content page?
      That was part of my question, but I guess the main issue is still:
      On 28 May, 00:42, eselk2...@gmail .com wrote:
      As of now I don't even know how to access the data in the master page,
      because I don't see any properties/methods of ObjectDataSourc e that
      return anything with "Rows" and "Fields".

      Comment

      • eselk2003@gmail.com

        #4
        Re: Access DataSource in code

        On May 28, 7:55 am, eselk2...@gmail .com wrote:
        As of now I don't even know how to access the data in the master page,
        because I don't see any properties/methods of ObjectDataSourc e that
        return anything with "Rows" and "Fields".
        I figured this out, and I'm using this code now, which works:

        Dim dv As DataView = Master.dsSubscr iber.Select()
        Dim row As DataRowView = dv.Item(0)
        Dim min_prior As Integer = row("MinPrior")

        But, can anyone tell me if the Select() call generates another trip to
        the database? I have a control which displays the data already, and
        it is already bound when I call Select(), so in that case does Select
        just come from a cache? I haven't looked at the caching options yet,
        but I think those are related to caches between multiple requests, and
        in this case I'm just wondering about caching within one request (one
        load of the page).

        Comment

        Working...