BrainDump
  Home arrow BrainDump arrow Page 4 - ADO Queries and Working with Recordsets
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 
Mobile Linux 
App Generation ROI 
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? 
BRAINDUMP

ADO Queries and Working with Recordsets
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 4
    2008-01-14

    Table of Contents:
  • ADO Queries and Working with Recordsets
  • Displaying Selected Records Using a Drop Down Menu
  • Sorting Records
  • How to Add a Record to Table
  • How To Delete a Record

  • 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


    ADO Queries and Working with Recordsets - How to Add a Record to Table


    (Page 4 of 5 )

    You can add records to a database using the INSERT INTO function from our dear friend SQL. The first step is to create an HTML form for the user to submit data to us:


    <html>

    <body>

    <p>Enter your data and click the Submit button to add a record to the database:</p>

    <form method=”post” action=”sampleform.asp”>

    <table>

    <tr>

    <td>Victim Name</td>

    <td><input name=”victim”></td>

    </tr>

    <tr>

    <td>Victim Injury</td>

    <td><input name-”injury”></td>

    </tr>

    <tr>

    <td>How It Happened</td>

    <td><input name=”how”></td>

    </tr>

    </table>

    <br /><br /><br />

    <input type=”submit”>

    </form>

    </body>

    </html>

    Next we must make an .asp page that will process the data:

     

    <html>

    <body>

    <%

    set conn=Server.CreateObject(“ADODB.Connection”)

    conn.Provider=”Microsoft.Jet.OLEDB.4.0”

    conn.Open “c:/website/chucknorrisvictims.mdb

    sql=”INSERT INTO Victims (VictimName,VictimInjury)”

    sql=sql & “ VALUES “

    sql=sql & “('” & Request.Form(“victim”) & “',”

    sql=sql & “'” & Request.Form(“injury”) & “',”

    sql=sql & “'” & Request.Form(“how”) & “')”

    on error resume next

    conn.Execute sql,recaffected

    if err<>0 then

    Response.Write(“You do not have permission to update this database”)

    else

    Response.Write(“<h1>” & recaffected & “has been added</h1>”)

    end if

    conn.close

    %>

    </body>

    </html>

    More BrainDump Articles
    More By James Payne


       · Welcome to my article on ADO Queries. Prepare to have your puny mind blown as you...
       · Hi James, I'd like to see an article dealing with how to import attribute-centric...
     

    BRAINDUMP ARTICLES

    - Internet Explorer 8 Review
    - Nilpo`s Top Windows Add-Ons
    - Beginning Silverlight 2.0 Development using ...
    - Fixing Vista`s Troubles
    - Preparing Windows Images for Mass Deployment
    - The Trouble With Vista
    - Slipstreamed and Unattended Windows Installa...
    - Microsoft Office SharePoint Server
    - Microsoft Office SharePoint Designer
    - Microsoft Windows SharePoint Services 3.0
    - Microsoft Live Mesh Overview
    - XAML Brushes and Silverlight
    - Silverlight and XAML Basics
    - Immortal XP
    - XAML Basics





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
    Stay green...Green IT