Access DataSource in code

  • Thread starter Thread starter eselk2003
  • Start date Start date
E

eselk2003

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
ObjectDataSource, 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 ObjectDataSource that return anything with "Rows" and
"Fields".
 
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
ObjectDataSource, 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 ObjectDataSource 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.
 
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:
 
I figured this out, and I'm using this code now, which works:

Dim dv As DataView = Master.dsSubscriber.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).
 
Back
Top