Hello,
thanks to Mr. BigRed1212 and Mr. gmmastros, I was able to create my insert page now the question is, how can I turn this into an edit page.
the problem is that the insert is taking the data from horizontal and putting it vertical. With the current update script that I wrote. It puts all the data into one field
for example
my input
answer1 answer2 answer3
32 33 34
41 37 25
5 7 1
after my update is executed I get this
answer1 answer2 answer3
32,41,5 33,37,7 34,25,1
I have tried a few things with no luck.
here is the input page
As always any help or suggestions are very much appreciated!!
thanks to Mr. BigRed1212 and Mr. gmmastros, I was able to create my insert page now the question is, how can I turn this into an edit page.
the problem is that the insert is taking the data from horizontal and putting it vertical. With the current update script that I wrote. It puts all the data into one field
for example
my input
answer1 answer2 answer3
32 33 34
41 37 25
5 7 1
after my update is executed I get this
answer1 answer2 answer3
32,41,5 33,37,7 34,25,1
I have tried a few things with no luck.
here is the input page
Code:
<%@ Language="VBScript" %>
<% Option Explicit %>
<html>
<head>
<title>Form to database</title>
</head>
<body>
<%
Function IsInteger(Data)
If Trim(Data) = "" Then
IsInteger = False
Else
IsInteger = IsNumeric(Data & ".0e0")
End If
End Function
'declare your variables
Dim itm, userid, i
Dim sConnString, connection, sSQL
'Receiving values from Form, assign the values entered to variables
itm = Split(Request.Form("itm"),",")
userid = Split(Request.Form("userid"),",")
'define the connection string, specify database
'driver and the location of database
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("qa.mdb")
'create an ADO connection object
Set connection = Server.CreateObject("ADODB.Connection")
'Open the connection to the database
connection.Open(sConnString)
For i = lBound(userid) to ubound(userid)
'declare SQL statement that will query the database
sSQL = "update answers (userid,itm) values ('" & _
trim(userid(i)) & "', '" & trim(itm(i)) & "')"
connection.execute(sSQL)
Next
'execute the SQL
' connection.execute(sSQL) don't need this line anymore
'Done. Close the connection object
connection.Close
Set connection = Nothing
Response.Redirect "thank_you.asp"
%>
</body>
</html>
As always any help or suggestions are very much appreciated!!