Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Textarea Question
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Textarea Question

 Post Reply Post Reply
Author
nsf247 View Drop Down
Newbie
Newbie


Joined: 12 February 2004
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote nsf247 Quote  Post ReplyReply Direct Link To This Post Topic: Textarea Question
    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.

 

 

 

 

 

Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Bullschmidt View Drop Down
Groupie
Groupie


Joined: 31 May 2003
Location: United States
Status: Offline
Points: 72
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bullschmidt Quote  Post ReplyReply Direct Link To This Post Posted: 17 February 2004 at 1:15am

Parsing with join and split - 5/9/1999
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

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

J. Paul Schmidt, Freelance ASP Web Developer
www.Bullschmidt.com
Classic ASP Design Tips, ASP Web Database Sample (Freely Downloadable)
Back to Top
ljamal View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 16 April 2003
Status: Offline
Points: 888
Post Options Post Options   Thanks (0) Thanks(0)   Quote ljamal Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.