Redirect Problem

W

WebHouse.Co

Hi Sir

I'm in my 2nd year in M.Sc. degree & I made a project about the
powerful tools SQLXML 3.0 & updategram, so I made a list of programs
which r they so similar to the example that using updategram with ASP
That exist in the documentation of the Microsoft SQL Server XML Tools
as the following page:


Sample ASP Application
This ASP application allows you to update customer information in the
Customers table in the Northwind database. The application does the
following
Ask user to enter a customer ID. Using this customer ID value, execute
a template to retrieve customer information from Customers table. This
information is displayed using an HTML form.
The user is then allowed to update customer information (not the
Customer ID because it is the primary key and also to keep the
application simple). Once the user hits the submit button, an
updategram (which is also a template) is executed. All the form
parameters are passed to the updategram.
This is the first template (GetCustomer.xml). Save this template in the
directory associated with virtual name of template type.
<root xmlns:sql="urn:schemas-microsoft-com:xml-sql">
<sql:header>
<sql:param name="cid"></sql:param>
</sql:header>
<sql:query>
SELECT *
FROM Customers
WHERE CustomerID=@cid
FOR XML AUTO
</sql:query>
</root>
This is the second template (UpdateCustomer.xml). Save this template in
the directory associated with virtual name of template type.
<ROOT xmlns:updg="urn:schemas-microsoft-com:xml-updategram">
<updg:header>
<updg:param name="cid"/>
<updg:param name="companyname" />
<updg:param name="contactname" />
<updg:param name="contacttitle" />
<updg:param name="address" />
<updg:param name="city" />
<updg:param name="region" />
<updg:param name="postalcode" />
<updg:param name="country" />
<updg:param name="phone" />
<updg:param name="fax" />

</updg:header>
<updg:sync >
<updg:before>
<Customers CustomerID="$cid" />
</updg:before>
<updg:after>
<Customers CustomerID="$cid"
CompanyName="$companyname"
ContactName="$contactname"
ContactTitle="$contacttitle"
Address="$address"
City="$city"
Region="$region"
PostalCode="$postalcode"
Country="$country"
Phone="$phone"
Fax="$fax" />
</updg:after>
</updg:sync>
</ROOT>
This is the ASP application (SampleASP.asp). Save it in the directory
associated with a virtual root created using Internet Services Manager
utility (this virtual root is not created using IIS Virtual Directory
Management for SQL Server utility because the handle of it does not
understand asp applications).
<% LANGUAGE=VBSCRIPT %>
<%
Dim CustID
CustID=Request.Form("cid")
%>
<html>
<body>
<%
'if cust id value is not yet provided, display this form
if CustID="" then
%>
<!-- the CustID has not been specified so we display the form that
allows users to enter an id -->
<form action="SampleASP.asp" method="POST">
<br>
Enter CustID: <input type=text name="cid"><br>
<input type=submit value="Submit this ID" ><br><br>
<-- Otherwise, we have already entered an customerID, so display the
second part of the form where the user can change cust info -->
<%
else
%>
<form name="Customer"
action="http://localhost/nwind/Template/UpdateCustomer.xml"
method="POST">
You may update customer information below.<br><br>
<!-- comment goes here to separate the parts of the application or page
-->
<br>
<%
' Let us load the document in the parser and extract the values to
populate the form.
Set objXML=Server.CreateObject("MSXML2.DomDocument")

objXML.async=False
objXML.Load("http://localhost/nwind/Template/GetCustomer.xml?cid="
& CustID)
set objCustomer=objXML.documentElement.childNodes.Item(0)
' In retrieving data form the database, if a value in the column is
NULL,
' we don't get any attribute for the corresponding element. In this
' case we want to skip the error generation and go to the next
attribute
On Error Resume Next

' get the cid attribute value
Response.Write "Cust ID: <input type=text readonly=true
style='background-color:silver' name=cid value="""
Response.Write objCustomer.attributes(0).value
Response.Write """><br><br>"

' get the companyname attribute value
Response.Write "Company Name: <input type=text name=companyname
value="""
Response.Write objCustomer.attributes(1).value
Response.Write """><br><br>"

' the contactname attribute
Response.Write "Contact Name: <input type=text name=contactname
value="""
Response.Write objCustomer.attributes(2).value
Response.Write """><br>"

' get the Contacttitle attribute value
Response.Write "Contact Title: <input type=text name=contacttitle
value="""
Response.Write objCustomer.attributes(3).value
Response.Write """><br><br>"

' get the address attribute value
Response.Write "Address: <input type=text name=address value="""
Response.Write objCustomer.attributes(4).value
Response.Write """><br><br>"

' the city attribute
Response.Write "City: <input type=text name=city value="""
Response.Write objCustomer.attributes(5).value
Response.Write """><br>"

' get the region attribute value
Response.Write "Region: <input type=text name=region value="""
Response.Write objCustomer.attributes(6).value
Response.Write """><br><br>"

' get the postalcode attribute value
Response.Write "PostalCode: <input type=text name=postalcode
value="""
Response.Write objCustomer.attributes(7).value
Response.Write """><br><br>"

' the country attribute
Response.Write "Country: <input type=text name=country value="""
Response.Write objCustomer.attributes(8).value
Response.Write """><br>"

' get the phone attribute value
Response.Write "Phone: <input type=text name=phone value="""
Response.Write objCustomer.attributes(9).value
Response.Write """><br><br>"

' the fax attribute
Response.Write "Fax: <input type=text name=fax value="""
Response.Write objCustomer.attributes(10).value
Response.Write """><br>"

set objCustomer=Nothing
Set objXML=Nothing
%>
<input type="submit" value="Submit this change" ><br><br>
<input type=hidden name="contenttype" value="text/xml">
<input type=hidden name="eeid" value="<%=CustID%>"><br><br>
<% end if %>
</form>
</body>
</html>





So, as u see this ASP program is so helpful for me & I depend on it not
only on my study but also in business jobs that I want to made

My problems is that if we want to execute this ASP file it'll work
very well but redirect the user after he made the submit to the
execution of the updateCustomer.xml because the action in the form is
set to this page to make the execution , so please help me to
execute the ASP file without showing the user the execution page of the
updateCustomer.xml page instead of that I can redirect the user to any
other page or the same
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top