Use ASP to combine JavaScript or VBScript to generate a dynamic Web page. When this method is used in practical applications, it is unavoidable to print out the results. We can also sort out the results of the query and print the output directly using the print buttons on the browser toolbar. The following program is to access the sales table from the database pubs in SQL Server, with VBScript on both the server and the workstation side. Navigator access is available when the workstation side uses JavaScript.
Sql=″select Stor_id,ord_num,ord_date,qty from sales where Ord_date〉′1994-5-1′″
Set Rs=cn.execute (SQL)
While not rs.eof
Is the last record of the decision?
Qtyv=rs (″qty″)
sumqtyv=sumqtyv+qtyv%〉
〈tr〉〈td〉〈%=rs (″stor_id″)%〉〈/td〉
〈td〉〈%=rs (″ord_num″)%〉〈/td〉
〈td〉〈%=rs (″ord_date″)%〉〈/td〉
〈td〉〈%=qtyv%〉〈/td〉〈/tr〉
〈%rs.movenext′ move to the next record wend%〉〈tr〉
〈TD colspan=″3″〉 Total 〈/td〉
〈td〉〈%=sumqtyv%〉〈/td〉
〈/tr〉〈/table〉〈%cn.close%〉〈/form〉〈/body〉〈/html〉
To ensure that you can print reports of various sizes, first set the paper size to the widest in your browser, and then output different report sizes by adjusting the value of the 〈table width=″″〉.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.