The example shows how to input data from a html page, write the records to a sql server database. After the record is written all the data is passed back to the asp page and written out Have an input form Example below show's some sample data being inputted.
Here is the results that are written out. Code for Asp Page
'Declares all local variables dim conn dim rs dim strsql dim strsql2 dim strsql3 'First part of formatted string strsql = "DECLARE " & CHR(10) & "@Id_Req " & "INT" & CHR(10) 'Second part of Formatted string-all values from form strsql2 ="exec " & "sp_EmpInfo" & " '" & request("txtFirstName") & "'," & "'" & request("txtLastName") & "', " & "'" & request("txtaddress") & "', " & "'" & request("txtcity") & "', "& "@Id_Req " & "OUTPUT" & chr(10) Third part of formatted string strsql3 ="SELECT * FROM AllData WHERE RecordId = @Id_Req" & Chr(10) 'Putting all the values together strsql = strsql & strsql2 & strsql3 response.write "<b>" & "Sql Statement that is passed to the database" & "</b>" & "<br>" & "<br>" response.write strsql 'Create connection object & open it set conn = server.createobject("adodb.connection") conn.open "example" 'Create recordset object & place string that is executed 'so values can be stored and written out set rs = server.createobject("adodb.recordset") rs = conn.execute(strsql) %> <html> <head> <title>Results Page</title> <meta name="GENERATOR" content="Microsoft FrontPage 3.0"> </head> <body>
<p><strong>Record Id # and all information entered on <br> previous page.</strong></p>
<table border="1" width="50%"> <tr> <td width="50%">ID Number: </td> <td width="50%"> <% = rs("recordid") %></td> </tr> <tr> <td width="50%">Date submitted:</td> <td width="50%"> <% = date() %></td> </tr> <tr> <td width="50%">First Name: </td> <td width="50%"> <% = rs("fname") %></td> </tr> <tr> <td width="50%">Last Name:</td> <td width="50%"> <% = rs("lname") %></td> </tr> <tr> <td width="50%">Address: </td> <td width="50%"> <% = rs("address") %></td> </tr> <tr> <td width="50%">City:</td> <td width="50%"> <% = rs("City") %></td> </tr> </table> <% set rs = nothing %> </body> </html>
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More Database Code Articles More By aspfree developerWorks - FREE Tools! | Learn field-tested SOA principles, methodology, technology and implementation from the global SOA market leader - in a new e-book by an IBM SOA expert. Written by IBM Certified SOA Solution Designer Bobby Woolf, "Exploring IBM SOA Technology & Practice" is the ultimate insider's guide to SOA - a PDF e-book packed cover to cover with IBM's specific advice on how to make your SOA implementation a success. FREE! Go There Now!
| | | | Download a free trial version of IBM Rational Developer for System z, software that can help you deliver core development capabilities; the power of Java Platform, Enterprise Edition (Java EE); and rapid application development support to diverse enterprise application development teams. With comprehensive development tools to help create, deploy and maintain traditional enterprise and composite applications, Rational Developer for System z enables developers with different technical backgrounds to easily participate in important technology projects. FREE! Go There Now!
| | | | Visit IBM developerWorks to download a free trial of the latest release of IBM Lotus Sametime Standard V8.0. Lotus Sametime Standard V8.0 is a platform for unified communications and collaboration that combines security features with an extensible, open solution including integrated Voice over IP, geographic location awareness, mobile clients, and a robust Business Partner community offering telephony and video integration. FREE! Go There Now!
| | | | Portfolio Management is about effectively managing portfolio value by aligning portfolio investments with business goals. This complimentary e-kit provides a collection of materials that can help you understand how IBM Rational enables and automates best practices for improved governance and clear visibility into portfolio and project performance across the entire IT project lifecycle. FREE! Go There Now!
| | | | Get a free trial download of the latest version of IBM Rational Functional Tester V7.0.1. Rational Functional Tester is an automated functional and regression testing solution for QA teams concerned with the quality of their Java, Microsoft Visual Studio .NET, and Web-based applications. FREE! Go There Now!
| | | | Try the latest version of IBM Rational Manual Tester V7.0.1 by downloading a free trial from IBM developerWorks. This manual test authoring and execution tool promotes test step reuse to reduce the impact of software change on testers and business analysts and addresses the needs of teams performing at least a portion of their testing manually. FREE! Go There Now!
| | | | Visit IBM developerWorks to try the IBM SOA Sandbox for people. The SOA Sandbox for people provides a trial environment with the necessary tooling and components required to enable consistent human and process interaction and collaboration, showing how you can improve user experience and business productivity. FREE! Go There Now!
| | | | As businesses grow increasingly dependent upon Web applications, these complex entities grow more difficult to secure. Most companies equip their Web sites with firewalls, Secure Sockets Layer (SSL), and network and host security, but the majority of attacks are on applications themselves – and these technologies cannot prevent them. This paper explains what you can do to help protect your organization, and it discusses an approach for improving your organization’s Web application security. FREE! Go There Now!
| | | | Join the IBM Watchfire team for an informative discussion on techniques and best practices to proactively manage Web application security and how to effectively build application security testing into the software development lifecycle (SDLC). In this Software Delivery Platform webcast you will learn: How to better understand potential web application security vulnerabilities, best practices and how to effectively integrate application security testing into the software development lifecycle, the importance of detecting and removing software vulnerabilities during application development. FREE! Go There Now!
| | | | The Eclipse community is constantly working to extend Eclipse's functionality. In this webcast, learn about some of the most important and feature-rich projects under development. From multi-language support to plug-in development, tune in to see what Eclipse is capable of now. FREE! Go There Now!
| | | | All FREE IBM® developerWorks Tools! | |