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! | You'll get answers to many questions and more from David Barnes, Lead Evangelist for IBM Emerging Internet Technologies. David will discuss aspects of Web 2.0 that bring value to corporations, academia, and government. He'll also discuss IBM's vision around Web 2.0, including the importance of remixability and consumability. The discussion will culminate with examples of various IBM Software Group solutions you can use to get ahead of the Web 2.0 adoption curve. FREE! Go There Now!
| | | | Join this webcast, to learn how the Rational Process Library can help with compliance issues, drive process improvement, and assist in service-oriented architecture (SOA) or Agile development. We will take a peek into the Rational Process Library with content around software and systems engineering (including RUP), operations and systems management, program and portfolio management, and asset and SOA governance. FREE! Go There Now!
| | | | 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!
| | | | Visit IBM developerWorks to download a free trial version of Lotus Quickr 8.0, which enables collaboration by transforming the way everyday business content such as documents, rich media, photos, and video can be shared. Lotus Quickr makes it faster and easier to share content of all types (not just documents) within virtual teams. It is designed to make it easier to collaborate across organizational boundaries, while continuing to work within the context of familiar desktop applications. 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!
| | | | Download a free trial version of IBM Rational Software Analyzer Developer Edition V7.0 to identify bug defects earlier in the software development cycle. Rational Software Analyzer is an extensible software development solution that reduces the expense of bug-fixes by enabling static analysis code reviews and bug identification very early in the development cycle. FREE! Go There Now!
| | | | This Fall, IBM Rational talks to you directly through a special teleconference series giving you access to the best minds in IBM Rational - product experts and market thought leaders who will answer your questions during these pre-scheduled telephone conference calls. Register today! FREE! Go There Now!
| | | | Join this Rational Talks to You teleconference on November 29 at 1:00 pm ET to participate in an interactive discusssion with Grady Booch around architecture and reuse. Get your questions answered! FREE! Go There Now!
| | | | This paper is about the critical role that a discipline called integrated requirements management can play in helping to ensure that your business goals and IT investments are continuously aligned—whether you are sourcing, integrating, building or maintaining software. It also looks at ways that automated IBM Rational® products can work together to help you use requirements in the very best way. FREE! Go There Now!
| | | | Explore how Rational and WebSphere software enable enterprise documentation in SOA environments. Specifically, a new integration between IBM WebSphere® Business Modeler and IBM Rational® Method Composer software can help technical writers more easily keep enterprise operations manuals in sync with changes that are made to business processes, resulting in more accurate and timely documentation that benefits the entire enterprise. FREE! Go There Now!
| | | | All FREE IBM® developerWorks Tools! | |