Closed Thread Icon

Topic awaiting preservation: ASP Save Form Fields to DB! (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=12075" title="Pages that link to Topic awaiting preservation: ASP Save Form Fields to DB! (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: ASP Save Form Fields to DB! <span class="small">(Page 1 of 1)</span>\

 
ASP Newbee Programmer
Nervous Wreck (II) Inmate

From: Carinthia
Insane since: Jan 2002

posted posted 03-02-2002 12:00

I´ve got a big Problem.
How do I save Form Fields into a DB.

If it´s possible, please post the whole Script.

I don´t know how this works.

Lurch
Paranoid (IV) Inmate

From: Behind the Wheel
Insane since: Jan 2002

posted posted 03-02-2002 19:25

edit - "doh"

[This message has been edited by Lurch (edited 03-02-2002).]

ASP Newbee Programmer
Nervous Wreck (II) Inmate

From: Carinthia
Insane since: Jan 2002

posted posted 03-03-2002 17:13

I think, that wouldn´t help much

tomeaglescz
Paranoid (IV) Inmate

From: Czech Republic via Bristol UK
Insane since: Feb 2002

posted posted 03-06-2002 12:26

are you hand coding your site or for example using something like dreamweaver ultradev....if you are planning on playing with databases and web sites i would seriously recommend it, as far as the code goes it would take way too long to post in here but essentially you will have to dump the value part of the name value pair in the form into a memory variable, i tend personally to use the same name as the row value in the database.

if ya need anymore help email me

have fun....

fizgig
Nervous Wreck (II) Inmate

From: West Bloomfield MI
Insane since: Aug 2001

posted posted 03-07-2002 14:43

<%@ Language=VBScript %>
<%
Option Explicit
'dimension variables
dim adoConnection
dim strConnect
dim rstAnswers, connectStr
dim firstName, lastName, email
dim question1, question2, question3, question4, question5, other

'request posted information
firstName = Request("firstName")
lastName = Request("lastName")
email = Request("email")
question1 = Request("question1")
question2 = Request("question2")
question3 = Request("question3")
question4 = Request("question4")
question5 = Request("question5")
other = Request("other")

'connection string and recordset
connectStr = "DSN=testdb; uid=sa; pwd="
'DSN less
'connectStr = "Provider=SQLOLEDB; Data Source=SERVERNAME; Initial Catalog=DATABASENAME; User ID=sa; Password="

'open connection to server
Set adoConnection = server.CreateObject("ADODB.Connection")
adoConnection.Open connectStr

Set rstAnswers = server.CreateObject("ADODB.Recordset")

'open recordset
With rstAnswers
.ActiveConnection = adoConnection
.CursorLocation = 3
.CursorType = 3
.LockType = 3
.Source = "SELECT * FROM tSurvey WHERE 1=2"
.Open
'create a new row
.AddNew
'populate recordset
.Fields("firstName")= firstName
.Fields("lastName")= lastName
.Fields("email")= email
.Fields("question1")= question1
.Fields("question2")= question2
.Fields("question3")= question3
.Fields("question4")= question4
.Fields("question5")= question5
.Fields("otherInfo") = other
.Fields("timeStamp") = NOW
'update recordset
.Update
'Close Recordset
.Close
End With

Set rstAnswers = nothing
adoConnection.Close
%>

[This message has been edited by fizgig (edited 03-07-2002).]

« BackwardsOnwards »

Show Forum Drop Down Menu