BOBKUSPE
08-19-2010, 12:52 PM
Hi,
I am trying import the data from textarea into database, but after dozen of attempts I am declining...
<html>
<head>
<title>Untitled</title>
</head>
<body>
<%
'Declare all local variables
dim conn
dim rs
dim strconn
dim strsql
strsql = ""
'set connection string to local variable-I use a DSN-less connection
%>
<%
strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("online.mdb")
%>
<%
Response.Write "<form method=get name=url>"
Response.Write "<textarea name=pageContent id=pageContent rows=10 cols=120 >"
response.write strplaintext
Response.Write "</textarea>"
txtValue = Request.Form("pageContent") %>
<%
DIM arr, arrLen, i, text
text = Request.Form("pageContent")
'Split the content of TextArea text into a array
arr = Split(Request.Form("pageContent"), CHR(13)&CHR(10))
arrLen = UBOUND(arr)
'Loop line by line
FOR i = 0 TO arrLen
Response.Write arr(i) & "<BR>"
NEXT
%>
<%
'build the sql statement based on the input from the form
strSQL = "INSERT INTO table1(url, pageContent)"
strSQL = strSQL & " SELECT "
strSQL = strSQL & "'" & request("url") & "' as text1,"
strSQL = strSQL & "'" & request("pageContent") & "' as text2"
set conn = server.createobject("adodb.connection")
conn.open strconn
'Use the execute method of the connection object the insert the record
conn.execute(strSQL)
conn.close
set conn = nothing
%>
<input type="Submit" value="Add" name="text" >
</form>
<% = "Your record has been added" %>
</body>
</html>
What is wrong in that script?
Bob Kuspe
I am trying import the data from textarea into database, but after dozen of attempts I am declining...
<html>
<head>
<title>Untitled</title>
</head>
<body>
<%
'Declare all local variables
dim conn
dim rs
dim strconn
dim strsql
strsql = ""
'set connection string to local variable-I use a DSN-less connection
%>
<%
strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("online.mdb")
%>
<%
Response.Write "<form method=get name=url>"
Response.Write "<textarea name=pageContent id=pageContent rows=10 cols=120 >"
response.write strplaintext
Response.Write "</textarea>"
txtValue = Request.Form("pageContent") %>
<%
DIM arr, arrLen, i, text
text = Request.Form("pageContent")
'Split the content of TextArea text into a array
arr = Split(Request.Form("pageContent"), CHR(13)&CHR(10))
arrLen = UBOUND(arr)
'Loop line by line
FOR i = 0 TO arrLen
Response.Write arr(i) & "<BR>"
NEXT
%>
<%
'build the sql statement based on the input from the form
strSQL = "INSERT INTO table1(url, pageContent)"
strSQL = strSQL & " SELECT "
strSQL = strSQL & "'" & request("url") & "' as text1,"
strSQL = strSQL & "'" & request("pageContent") & "' as text2"
set conn = server.createobject("adodb.connection")
conn.open strconn
'Use the execute method of the connection object the insert the record
conn.execute(strSQL)
conn.close
set conn = nothing
%>
<input type="Submit" value="Add" name="text" >
</form>
<% = "Your record has been added" %>
</body>
</html>
What is wrong in that script?
Bob Kuspe