Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 17th, 2004, 02:43 PM
Registered User
 
Join Date: Sep 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reading from Database to Online Form

Hi all ,
i am struggling with the problem of how to read data from a database and insert it into an online form.
Basically the setup is as follows :
 - user inputs information into online form either by typing or selecting from various options shown and when finished hits submit button
 - data is successfully inserted into database

I can read from the database onto a 'blank canvas' ok but do not know how to insert the information that the user has inputted into the database into the form that was originally filled out.

Also , i would like to allow the user to be able to partially complete the form , logout , return to the form and be able to see what they have previously inputted and to continue from where they left of. If possible , i would also like to allow the user to change what they have previously inputted.

I am using MS Access 2000 as the database.

Thanhk-you for taking the time to read this plea for help and any assistance offered would be greatly appreciated,
larry101


 
Old December 21st, 2004, 11:40 PM
Registered User
 
Join Date: Dec 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

this is really simple:

if you can read data from the DB, simply write the field contents to the HTML form fields. for example:

<input type="text" name="txtFirstName" value="<%=rs.Fields("First_Name").Value%>">

do this for all of your corresponding HTML form fields.

when the user goes to update their record, make sure you pass the record key w/ its value to your SQL statement. This can be written to a "hidden" input HTML tag in your form. While you'll probably query the database with a QueryString value (e.g. getrecord.asp?id=2) to retrieve the record initially, I typically pass the key from the DB as opposed to the key value from the query string:

<input type="hidden" name="intID" value="<%=rs.Fields("id").Value%>">

if the user is editing an existing record, simply pass the updated form data to an UPDATE sql statement and you should be good.

hope this helps.





Similar Threads
Thread Thread Starter Forum Replies Last Post
problem connecting to my online database umair_rathore Classic ASP Databases 1 February 9th, 2005 01:04 PM
Trouble connecting to an online database. toddbryan Classic ASP Databases 2 October 27th, 2004 12:04 AM
manage database online aliasp Classic ASP Databases 2 March 5th, 2004 01:20 AM
Online Task Request Form pill Classic ASP Professional 0 February 4th, 2004 05:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.