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 September 19th, 2003, 09:58 AM
Authorized User
 
Join Date: Aug 2003
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default database question.

Hi,

I made a application form and stored values of the field in the database, so i can allow them to change the field values. IE.
ID | FIELD NAME
---------------
1 | First Name:
---------------
2 | Last Name:

etc...

Is there a way that i can store the data when the user completes the form in a database. Do i have to create another database? And the column names have to be Field1, field2, field3 right, since the field names are dynamic and there is no way i can have column names the same as the field names?




 
Old September 20th, 2003, 02:36 PM
Authorized User
 
Join Date: Sep 2003
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Column name can be anything as you like, as long as not the reserved words if you using the SQL statment.

for Stored value, first you should insert the record, and you should have a field as autonumbered, so you can got the the record as form the autonumber, afterward you can update, and stored value.

 
Old September 23rd, 2003, 04:09 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 171
Thanks: 0
Thanked 1 Time in 1 Post
Default

What type of database are you using?

 
Old September 23rd, 2003, 11:34 PM
Authorized User
 
Join Date: Aug 2003
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

accesss

 
Old September 24th, 2003, 01:50 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 171
Thanks: 0
Thanked 1 Time in 1 Post
Default

Here you go. Let me know how it works for you.

Page1.asp as follows...
<form method="Post" action="Page2.asp">
<input type="text" name="FirstName" value="">
<input type="text" name="LastName" value="">
<input type="Submit" Value="Submit">
</form>


Page2.asp as follows...
<%
    db = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=whatever.mdb"

    FirstName = request("FirstName")
    LastName = request("LastName")

    set rs = server.createobject("adodb.recordset")
    sql = "select * from table"
    rs.open sql, db, 3, 3
    rs.addnew
    rs("FirstName") = FirstName
    rs("FirstName") = LastName
    rs.update
%>

NOTE:
rs("FirstName"), rs("LastName") are the fields in the database itself.

FirstName = request("FirstName"), LastName = request("LastName") are the values that you are requesting from the page that has the form that the user submits.

 
Old September 29th, 2003, 03:11 PM
Authorized User
 
Join Date: Aug 2003
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks. works great.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Question rose77 Access 0 January 9th, 2005 02:14 PM
Database question hlchuah77 SQL Language 5 November 12th, 2004 12:40 PM
Database question! Calibus Classic ASP Databases 3 August 17th, 2004 05:23 PM
HELP database question TnTandyO Classic ASP Databases 0 December 1st, 2003 12:39 PM
database question writedom VS.NET 2002/2003 2 July 29th, 2003 05:58 AM





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