Web Analytics Made Easy -
StatCounter TextArea issue - CodingForum

Announcement

Collapse
No announcement yet.

TextArea issue

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • TextArea issue

    Tried a couple of forums. No one seems to be able to clearly explain how to do this. HELP! I know it can be done, i just can't get the syntax right. All i need to do is get the contents of a text area box and insert it into an access database. The complex part is this. For what i need to accomplish is to use a text area form field to collect multiple lines of data but on submit, allow those lines to be saved in seperate rows to an access database. Say instead of having 20 text fields for the user to enter, Create one text area, and require that when copy and pasting or just entering data, that the first line of the text area goes to an access row, the second line goes to the next available row and so on. I guess it would be something lie this...

    Name of text area (myTextArea)
    <textarea>
    Enter DATA - 1 Line (go to row 1 in db)
    Enter DATA- 1 line (go to row 2 in db)
    Enter DATA - 1 line (go to row 3 in db)
    </textarea>

    I hope that was clear.

    Now i know i can use the split function to take care of the data entered. Something like this...

    Dim strTextArea
    Dim arrTextLines

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


    arrTextLines(0)
    arrTextLines(1)

    Something like that. But the part i'm having trouble with is, how do i get that array into a variable that Access will understand that it needs to update itself row by row, in whatever column I choose, that each line entered in the text area needs to go into it's own next available DB row. Can someone give me a code snippet on how they would accomplish that. Does it involve a loop? Just can't get it to work, sigh.

    Example
    <textarea>
    info 1
    info 2
    info 3
    <textarea>

    After submit, take those lines to column 3 row by row the databse table would look something like this

    COLUMN 1, COLUMN 2, Column 3
    Row 1 info 1
    Row 2 info 2
    Row 3 info 3

    I hope that was kind of a clear explanation. If anyone can help, it would be greatly appreciated!!!!

  • #2
    Loop through the array and do an INSERT INTO statement. I assume you already know ADO but just in case, here's a good reference.
    Glenn
    vBulletin Mods That Rock!

    Comment


    • #3
      If you're using Access, use the text datatype and you shouldn't have to split it into different fields... I believe this is what you were getting at in your other post.

      You just need to change the datatype, and it will accept more characters. I forget offhand how many Access allows for the text datatype, since I use SQL Server pretty exclusively... but a google search may just turn that up.
      Former ASP Forum Moderator - I'm back!

      If you can teach yourself how to learn, you can learn anything. ;)

      Comment


      • #4
        Originally posted by glenngv
        Loop through the array and do an INSERT INTO statement. I assume you already know ADO but just in case, here's a good reference.
        Marcus Tucker / www / blog
        Web Analyst Programmer / Voted SPF "ASP Guru"

        Comment


        • #5
          P.S. You might have changed nicknames, but this is a problem that has a simple solution.

          As mentioned in responses your previous posts, you just need to use the right datatype to store your data.

          You might want to google it...

          Anyway, Access's text field should do fine. Just store ONE field of long data, instead of trying to split it up. It seems you're still confused on this issue.

          If you really do need to split it up into different fields, then don't use a textarea, and require users to put their information into different <input type="text"> fields. Problem solved.
          Former ASP Forum Moderator - I'm back!

          If you can teach yourself how to learn, you can learn anything. ;)

          Comment


          • #6
            I got it now

            Sorry, about no replys. I seem to be getting the mail really late. But what i did was really study on my own how arrays worked in more detail and with a little assistance, i got it going and understand all the syntax. Thanks all.

            Comment

            Working...
            X