Access DataSource in code

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".
 
S

Stan

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.
 
E

eselk2003

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:
 
E

eselk2003

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top