Database Code
  Home arrow Database Code arrow Demo on how to insert records into Multipl...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DATABASE CODE

Demo on how to insert records into Multiple tables with one html form and one asp form.
By: aspfree
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 25
    1999-11-15

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    <br>
    <table BORDER="0" CELLSPACING="0" CELLPADDING="0" WIDTH="390" height="63"><br>
    <tr><br>
    <td height="24"><big><font face="Verdana"><big><strong>Post A Match</strong></big></font></big></td><br>
    </tr><br>
    </table><BR><br>
    <div align="center"><center><p>&nbsp;</p><br>
    </center></div><blockquote><br>
    <div align="left"><table><br>
    <tr><br>
    <td ALIGN="right"><strong>User name:</strong></td><br>
    <td><input TYPE="TEXT" NAME="YourName" SIZE="25"> </td><br>
    </tr><br>
    <tr><br>
    <td ALIGN="right"><strong>Opponent's name:</strong></td><br>
    <td><input TYPE="TEXT" NAME="OpponentName" SIZE="25"> </td><br>
    </tr><br>
    <tr><br>
    <td ALIGN="right"><strong>Games Scores&nbsp; Results:</strong></td><br>
    <td>Your Score<strong> <select name="YourScore" size="1"><br>
    <option value="12">12</option><br>
    <option value="13">13</option><br>
    <option value="14">14</option><br>
    <option value="15">15</option><br>
    </select>&nbsp; </strong>Opp's Score<strong> <select name="OpponentScore" size="1"><br>
    <option value="9">9</option><br>
    <option value="10">10</option><br>
    <option value="11">11</option><br>
    </select></strong></td><br>
    </tr><br>
    </table><br>
    <p><input type="Submit" value="Submit Results" name="btnSubmit"> </p><br>
    </form><br>
    </body><br>
    </html></p>
    <h3>Page 2--The Process Form</h3>
    <p><% @Language="VbScript" %><br>
    <% <br>
    <br>
    <b>'Declare all local variables</b><br>
    dim conn<br>
    dim strconn<br>
    dim Gamers<br>
    dim strsql<br>
    dim strID<br>
    <br>
    <b>'Sets the DSN-less connection string to a local variable</b><br>
    strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("MultiTable.mdb")<br>
    <br>
    <b>'Opens a connection object</b><br>
    set conn = server.createobject("adodb.connection")<br>
    conn.open strconn<br>
    <br>
    <b>'Records when the game was played table</b><br>
    set GameRS = Server.Createobject("adodb.recordset")<br>
    GameRS.open "tblWhenPlayed", conn, 3, 3<br>
    GameRS.addnew <br>
    GameRS("WinnersName") = request.form("YourName")<br>
    GameRS("LosersName") = request.form("OpponentName")<br>
    GameRS("DatePlayed") = Date()<br>
    GameRS.update<br>
    GameRS.movelast<br>
    <br>
    <b>'Get the Game ID that is created when the record was created</b><br>
    strID = GameRS("GameID")<br>
    GameRS.Close<br>
    set GameRS = nothing<br>
    <br>
    <b>'Records Winner's into the Losers table</b><br>
    strSQL = "INSERT INTO tblWinners(GameID, ZoneName, NumOfPoints)"<br>
    strSQL = strSQL & " SELECT "<br>
    strSQL = strSQL & strID & " as text1," <br>
    strSQL = strSQL & "'" & request("YourName") & "' as text2,"<br>
    strSQL = strSQL & request("YourScore") & " as text3"<br>
    conn.execute(strsql)<br>
    <br>
    <b>'Records Losers Info into the Losers table</b><br>
    strSQL = "INSERT INTO tblLosers(GameID, ZoneName, NumOfPoints)"<br>
    strSQL = strSQL & " SELECT "<br>
    strSQL = strSQL & strID & " as text1," <br>
    strSQL = strSQL & "'" & request("OpponentName") & "' as text2,"<br>
    strSQL = strSQL & request("OpponentScore") & " as text3"<br>
    conn.execute(strsql)<br>
    <br>
    conn.close<br>
    set conn = nothing<br>
    <br>
    %><br>
    </p>
    <p><html><br>
    <head><br>
    <title>Post Score Summary</title><br>
    </head><br>
    <body><br>
    <h1>Your Record has been recorded</h1><br>
    <h3>Here is your Unique ID:<% = strID %></h3><br>
    <p>This demo has just inserted data into Three different tables</p><br>
    </body><br>
    </html><br>
    </p>


    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

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! Accelerating Software Innovation on i on Power Systems

    Attend this launch webcast with Scott Hebner, Vice President of IBM Rational Marketing and Strategy, for an overview of Rational’s new software offerings and resources to help modernize and accelerate software innovation on i on Power Systems – while ensuring past application investments are protected and continue to grow. Learn how these solutions are helping customers extend their core i5/OS solutions toward modern architectures such as SOA and web technologies to deliver business improvements that stand the test of time.
    FREE! Go There Now!


    NEW! Addressing software-as-a-service challenges using Tivoli security and WebSphere solutions

    Building a software-as-a-service solution requires addressing a few key technical challenges. In this webcast, we'll focus on the role of IBM Tivoli Directory Server and WebSphere Portlet Factory in creating a Software as a Service solution. We will demonstrate how to use Tivoli Directory Server to prevent the user population of one tenant from accessing the virtual portal and portlet components of another tenant. We will also use the dynamic profile capability of WebSphere Portlet Factory to create multiple highly customized applications from one code base.
    FREE! Go There Now!


    NEW! BlammoSplat: Build a community Web site of OpenLaszlo animations, Part 3: The community animation

    Learn to enable users to both rate existing animations and to combine existing animations into new snippets. This is the third in a series of three tutorials that chronicle the building of a site that enables collaborative discussion and animation building using Domino and OpenLaszlo.
    FREE! Go There Now!


    NEW! Don't wait! Try the Rational Application Developer (RAD) v7.5 open beta code today

    Download the Rational Application Developer (RAD) v7.5 open beta code and start developing applications for the JEE5 standard which features EJB3.0, JPA, JSF 1.2, JSP 2.1 and Servlet 2.5 standards. When you use this beta you will see how you can increase developer productivity for already existing applications with improved support for refactoring, as well as adding new features to existing applications. In addition, the beta provides tooling for JD Edwards, Oracle, SAP, Siebel and PeopleSoft to improve the developer productivity with these enterprise systems.
    FREE! Go There Now!


    NEW! Section 508 of the U.S. Rehabilitation Act: Web accessibility compliance

    Because access to government information continues to be an area of concern for many U.S. citizens with disabilities, the U.S. government enacted Section 508 of the Rehabilitation Act in 2001 to ensure that government agencies create accessible Web content, enabling all citizens to access the information they need. A fully accessible Web site makes Web content accessible to all individuals, including those with disabilities, who may be accessing Web content via a variety of user agents. Common user agents include standard Web browsers, text-only browsers, assistive devices and mobile devices such as cell phones or personal digital assistants (PDAs).
    FREE! Go There Now!


    NEW! The dirty dozen: preventing common application-level hack attacks

    As organizations have grown increasingly dependent on online software, the risk of malicious attacks has also become far more serious. Fortunately, well-governed organizations can protect their Web applications by injecting vulnerability assessments and ethical hacks into their software development and delivery processes. This paper describes 12 of the most common hacker attacks and provides basic rules that you can follow to help create more hack-resistant Web applications.
    FREE! Go There Now!


    NEW! Trial download: IBM Rational Method Composer V7.2

    Get a free trial download of the latest version of IBM Rational Method Composer V7.2 which helps you deliver customized yet consistent process guidance to your project teams and IT organization, and includes the latest version of IBM Rational Unified Process (RUP), which has provided process guidance to teams since 1996.
    FREE! Go There Now!


    NEW! Try the IBM SOA Sandbox for Connectivity

    Visit IBM developerWorks to try the IBM SOA Sandbox for connectivity. The SOA Sandbox for connectivity provides a trial environment with the tooling and components to help you explore how to effectively connect your infrastructure and integrate all of the people, processes and information in your company. Use the hosted sandbox to explore SOA techniques that streamline connecting existing IT assets together, as well as learn how to connect them to new business logic.
    FREE! Go There Now!


    NEW! Try the IBM SOA Sandbox for People

    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!


    NEW! Whitepaper: Delivering SOA solutions: service lifecycle management

    The unprecedented scope of a service-oriented architecture (SOA) initiative brings to the forefront a number of management and governance issues that were sidestepped in the past. The key to a successful SOA implementation is managing and governing activities throughout the entire SOA delivery lifecycle by ensuring that services conform to the needs of all of the business’s stakeholders. Learn how service lifecycle management allows the business to ensure that the process by which services are defined, created, tested, deployed, optimized and retired is manageable, repeatable and auditable.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    DATABASE CODE ARTICLES

    - Deployment of the MobiLink Synchronization M...
    - MobiLink Synchronization Wizard in SQL Anywh...
    - Finding Matching Records in Data Access Pages
    - Using the AccessDataSource Control in VS 2005
    - A Closer Look at ADO.NET: The Command Object
    - A Closer Look at ADO.NET: The Connection Obj...
    - Using ADO to Communicate with the Database, ...
    - Code Snippets: Counting Records
    - Constraints In Microsoft SQL Server 2000
    - Multilingual entries into a DB and to be dis...
    - Getting A List of Tables From SQL Server
    - SQL Server Database Creator - .NET Version
    - ADO Recordset Paging
    - Two combos, one textbox example
    - Discussion & Listserv Module by Mike Eck...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek