Print Page | Close Window

Textarea Question

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=9780
Printed Date: 31 March 2026 at 4:54pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Textarea Question
Posted By: nsf247
Subject: Textarea Question
Date Posted: 12 February 2004 at 1:40pm

Relatively new to ASP coding, so have been looking around for code snippets and tutorials on how to do this, but i can't seem to piece it together in working code. Forgive me if the explanation is a little choppy. What i am trying to do is take a text area, split up the data by line and insert each line as a seperate database entry into an Access db. I don't want to use 20 text boxes. :) 

let's just say this is called "mytextarea'

<textarea>
Line 1 - on submit goes to an access row
Line 2 - on submit goes to next row
Line 3 - on submit goes to next row
</textarea>

Now, I discovered could use something like this for the split of the data

Dim strTextArea
Dim arrTextLines

strTextArea = request.form("myTextArea")
arrTextLines = Split(strTextArea,vbNewLine,-1,1)


But, then how do I get the output of that into a variable or perhaps a series of variables for each line entered that Access will recognize as a loop that needs to be entered in a column, row by row? Could someone help me with a code snippet showing an example of grabbing the textarea info with the line by line split, how it's placed in a loop then a variable (I guess :P) then just a fake insert of that variable into a fake database table, populating the db with the array. Just to get an idea, so i can study it and incorporate it? I hope this was clear.
Thanks in advance.

 

 

 

 

 




Replies:
Posted By: pmormr
Date Posted: 12 February 2004 at 6:20pm
you could probably use an array... unfortunately i'm not experienced in ASP arrays so you'll have to look them up

-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: Bullschmidt
Date Posted: 17 February 2004 at 1:15am

Parsing with join and split - 5/9/1999
http://www.4guysfromrolla.com/webtech/050999-1.shtml - http://www.4guysfromrolla.com/webtech/050999-1.shtml

Passing Arrays from One ASP Page to Another, Part 2 - 10/19/1999
http://www.4guysfromrolla.com/webtech/101999-1.2.shtml - http://www.4guysfromrolla.com/webtech/101999-1.2.shtml

Q5824 I have string values that look like this: "name, age, height" - How do I parse these so I can reference each value?
http://developer.irt.org/script/5824.htm - http://developer.irt.org/script/5824.htm



-------------
J. Paul Schmidt, Freelance ASP Web Developer
www.Bullschmidt.com - www.Bullschmidt.com
Classic ASP Design Tips, ASP Web Database Sample (Freely Downloadable)


Posted By: ljamal
Date Posted: 17 February 2004 at 9:05am
You already have the array (arrTextLines), so then do the loop with the database insert

For i = 0 to Ubound(arrTextLines)
strSQL = "insert into table values ('"&arrTextLines(i)&"')"
Conn.Execute(strSQL)
Next

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net