Display form and read the database from the same page
Hello All
I want to display a form with the following three fields:
CustomerID
ShipCity
ShipCountry
with a Execute button. Once the Execute button is pressed I want in the
same ASP page to query the local SQL Server Northwind database Orders
table and display the matching records from the following query like :
Select * from Orders where CustomerId = FormFieldCustomerId or
ShipCity = FormfieldShipCity or
ShipCountry = FormfieldShipCountry
Can somebody please share the ASP page code whereby in one page I can
get the formfields validate the form fields and execute the query and
display the results in the form of a HTML table all in the same page. I
do not want to have a HTML form field and a ASP page called from the
HTML page I want all to be in one page.
Thanks in advance
Karen
Re: Display form and read the database from the same page
<html>
<body>
<form method="post">
your first view of page here...
</form>
<%
Dim sFormFieldCustomerId, sFormfieldShipCity, sFormfieldShipCountry
sFormFieldCustomerId = Request.Form("FormFieldCustomerId")
sFormfieldShipCity = Request.Form("FormfieldShipCity")
sFormfieldShipCountry = Request.Form("FormfieldShipCountry")
If sFormFieldCustomerId & sFormfieldShipCity & sFormfieldShipCountry <> ""
Then
''your code to execute that query here and get recordset
%>
<your html to display results>
<%
''close and destroy objects
End If
%>
</body>
</html>
Ray at work
<karenmiddleol [at] yahoo.com> wrote in message
news:1127908221.983418.34070 [at] z14g2000cwz.googlegroups.com...
> Hello All
>
> I want to display a form with the following three fields:
>
> CustomerID
> ShipCity
> ShipCountry
>
> with a Execute button. Once the Execute button is pressed I want in the
> same ASP page to query the local SQL Server Northwind database Orders
> table and display the matching records from the following query like :
>
> Select * from Orders where CustomerId = FormFieldCustomerId or
> ShipCity = FormfieldShipCity or
> ShipCountry = FormfieldShipCountry
>
> Can somebody please share the ASP page code whereby in one page I can
> get the formfields validate the form fields and execute the query and
> display the results in the form of a HTML table all in the same page. I
> do not want to have a HTML form field and a ASP page called from the
> HTML page I want all to be in one page.
>
> Thanks in advance
> Karen
>
Re: Display form and read the database from the same page
Perhaps this may hopefully give you some ideas:
Classic ASP Design Tips - Search Criteria on Multiple Fields
http://www.bullschmidt.com/devtip-searchcriteria.asp
Best regards,
J. Paul Schmidt, Freelance Web and Database Developer
http://www.Bullschmidt.com
Classic ASP Design Tips, ASP Web Database Sample
*** Sent via Developersdex http://www.developersdex.com ***
Re: Display form and read the database from the same page
And this:
Classic ASP Design Tips - Post Back Page
http://www.bullschmidt.com/devtip-postbackpage.asp
Best regards,
J. Paul Schmidt, Freelance Web and Database Developer
http://www.Bullschmidt.com
Classic ASP Design Tips, ASP Web Database Sample
*** Sent via Developersdex http://www.developersdex.com ***