SunQuest
 
       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  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Actuate Whitepapers 
Moblin 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
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 / 21
    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

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    <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!


    Build Forge Express demo: Enabling software delivery excellence for small and midsized businesses

    This demonstration gives you an overview of IBM® Rational® Build Forge Express Edition, a global offering that provides a framework to automate and execute software processes. Rational Build Forge provides a software assembly line that can support all of your tools, technologies, and platforms so you can achieve a repeatable, reliable, and traceable build and release process.
    FREE! Go There Now!


    IBM DB2 Deep Compression ROI Tool

    The IBM DB2 Deep Compression ROI tool is designed for DBA’s and IT management personnel to perform a clinical analysis of the cost savings gained from the Storage Optimization feature of DB2 9 for Linux, UNIX and Windows. The feature, also known as Deep Compression, compresses data that lies within a database by up to 80% at times.
    FREE! Go There Now!


    NEW! "ebook: Exploring IBM SOA Technology & Practice

    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!


    NEW! Best practices for software analysis: An introduction to the IBM Rational Software Analyzer application

    This whitepaper presents the benefits of successfully introducing static analysis into your organization using IBM Rational Software Analyzer. Additionally, it identifies some common pitfalls that can hinder the effective use of static analysis tooling as well as presents 10 simple strategies designed to help you quickly realize the value of static analysis using Rational Software Analyzer.
    FREE! Go There Now!


    NEW! Build Web services with transport-level security using Rational Application Developer V7, Part 1: Build Web services and Web services clients

    Build secure Web services with transport-level security using IBM Rational Application Developer V7 and IBM WebSphere Application Server V6.1. Follow this three-part series for step-by-step instructions about how to develop Web services and clients, configure HTTP basic authentication, and configure HTTP over SSL (HTTPS). This first part of the series walks you through building a Web service for a simple calculator application. You generate and test two different types of Web services clients: a Java Platform, Enterprise Edition (Java EE) client and a stand-alone Java client. You also handle user-defined exceptions in Web services.
    FREE! Go There Now!


    NEW! IBM Enterprise Modernization Sandbox for System z: Architecture

    Analysts, architects, and developers who have existing COBOL or PL/I skills and want to extend those skills to deploy new workloads on the mainframe can use the IBM Enterprise Modernization Sandbox for System z to find hands-on walkthroughs of common real world scenarios. The scenarios provide examples of how to rapidly design, create, assemble, test, and deploy high-quality Web, Web services, portal, and SOA applications for IBM CICS, IBM IMS, and IBM WebSphere Application Server.
    FREE! Go There Now!


    NEW! Rational Build Forge Express eKit

    Rational Build Forge Express Edition is an automation framework that packages the latest enterprise-grade technologies into a reliable, flexible and robust configuration designed and priced specifically for small to midsize businesses. The new Rational Build Forge Express eKit provides you with valuable resources – including a case study, podcast, demo, and articles – to help you increase staff productivity, compress development cycles and deliver better software, fast.
    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! Webcast: Application security testing and Web compliance

    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!


    NEW! Webcast: Striking the right balance between manual and automated testing

    Join this webcast to learn how IBM Rational's Functional Testing solution enables you to implement automation your way, at your pace, with your existing staff. In this webcast, you’ll learn how you can eliminate redundancy of manual test scripts, reduce errors, and increase test coverage through test automation. After this presentation you will understand how IBM Rational Functional Testing solution can streamline your manual testing and make test automation easily attainable.
    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-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway