Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

multiple pages

Status
Not open for further replies.

david7777777777

Programmer
Sep 26, 2001
417
US
Here's a common problem I'm having and I'll use a specific example. I've got a (VI 6) data entry ASP page that contains DTC's that users will use to enter a new employee record into the SQL 2000 database. Becasue I'm using the addImmediate method, you have to click a command button (btnNewEmployee in this case) in order to "initialize" a new blank record via the record set. Then you fill in the DTC's with the new employee's information, then click the Save (btnSave) button, which fires the addImmediate.

I'd like to place the btnNewEmployee button on its own page (newemployee1.asp) and have its click event not only initialize a new record for the Record Set on the second page (newemployee2.asp) but also navigate to the second page where the users will fill in the DTC's and click the Save button. I've tried to figure out how to do this page-to-page stuff using the page object but I'm beginning to think that I'm asking too much of the page object. Am I just missing some know-how? Thanks.
 
You want to open up newemployee2.asp initialised for a fresh row of data? Is this the only job for newemplyee2? Or is it to be used as a display/update form as well?

You would typically pass parameters to a web page via the query string (the stuff after a ? in the url). Your code would then inspect the parameters with Request.QueryString("parameter_name"). So you could call your page with a 'mode' switch:
myurl.asp?mode=new
and in the page code:
if Request.QueryString("mode") = "new" then
'..initialise recordset..

A PageObject formalises these parameters, so you can 'call' a page as though it were a function. It simply looks at the query string and calls the appropriate function for you.
This guarantees that your function is called AFTER the page initialisation code (script object model) - so your code can refer to recordsets and other DTC objects without failure.

I find that creating an empty recordset with the clause
WHERE 1=0
and then execute
rsMyRecordset.addNew
will create an empty row buffer.
Unfortunately the addNew option seems to be forgotten in server round-trips - and you may need to update the DTC to fix this (I think I put a fix in the FAQ section).

Alternatively, use unbound controls for your ADD function. You will not need a recordset, or use the addNew or addImmediate. Just add an INSERT query (or a Stored Procedure) in the DataEnvironment , then

thisPage.createDE
DE.insMyInsertFunction col1, col2, col3...
set DE = nothing

So you can call an INSERT command as though it was a function call, passing the column values as parameters.
(Content Management)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top