String Manipulation Before Posting to a Database

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default String Manipulation Before Posting to a Database

    Hi All:

    I am having difficulty with manipulating data coming from a form which is
    then posted to a database. The from contains a mixture of check boxes, and a
    text box for "other" with a default value of NA, all of which have the same
    name value of specialty.

    When I complete the form, and send it to a page to post to the database, a
    response.write for the form field delivers a comma delimited list of
    "items", which is what I expected, such as:
    Allergy and Immunology, Anesthesiology, NA

    If the text box is filled in then I would get:
    Allergy and Immunology, Anesthesiology, Test

    When the text field is NA, I want to eliminate it from the text string, so I
    end up with:
    Allergy and Immunology, Anesthesiology
    Before splitting on the comma, and posting to the database.

    I can get rid of the NA doing this:
    strTemp = request.form("specialty")
    strTemp1 = replace(strTemp,"NA"," ")

    This yields:
    Allergy and Immunology, Anesthesiology,

    Note the trailing comma..if I leave it in, I get an extra blank record in
    the database...but I cannot figure out how to get rid of it.

    Any help would be greatly appreciated.

    Steve G




    Steve G Guest

  2. Similar Questions and Discussions

    1. String Manipulation - Easiest Way?
      I have a field in a database that contains records that look like this: I'm trying to find the easiest (i.e. fewest lines of code) way to strip...
    2. Another String Manipulation Question
      Let's say I have a variable like this: 12345432112347890 The characters in the variable will always be different, but my goal will always be...
    3. String manipulation
      Hi! I am trying to figure out a simple, Perl way to break down any sting similar to the following: $s0 =...
    4. String manipulation and category building.
      I have been working in this problem for weeks and I was determined to sort it myself however I feel I need guidance to proceed forward. What I am...
    5. string manipulation problem - Replace
      Hi all, I'm new to ASP so this is probably a problem caused by me.... but here goes. I have been pulling some information from an access database...
  3. #2

    Default Re: String Manipulation Before Posting to a Database

    Steve G wrote:
    > Hi All:
    >
    > I am having difficulty with manipulating data coming from a form
    > which is then posted to a database. The from contains a mixture of
    > check boxes, and a text box for "other" with a default value of NA,
    > all of which have the same name value of specialty.
    >
    > When I complete the form, and send it to a page to post to the
    > database, a response.write for the form field delivers a comma
    > delimited list of "items", which is what I expected, such as:
    > Allergy and Immunology, Anesthesiology, NA
    >
    > If the text box is filled in then I would get:
    > Allergy and Immunology, Anesthesiology, Test
    >
    > When the text field is NA, I want to eliminate it from the text
    > string, so I end up with:
    > Allergy and Immunology, Anesthesiology
    > Before splitting on the comma, and posting to the database.
    >
    > I can get rid of the NA doing this:
    > strTemp = request.form("specialty")
    > strTemp1 = replace(strTemp,"NA"," ")
    >
    > This yields:
    > Allergy and Immunology, Anesthesiology,
    >
    > Note the trailing comma..if I leave it in, I get an extra blank
    > record in the database...but I cannot figure out how to get rid of it.
    How about:
    strTemp1 = replace(strTemp,", NA","")

    Bob Barrows
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Bob Barrows Guest

  4. #3

    Default Re: String Manipulation Before Posting to a Database

    Great <S>
    Thanks Bob...I must have tried 20 variations on that theme, but just could
    not get it right.

    Steve G

    "Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
    news:O2Md3x62DHA.1672@TK2MSFTNGP12.phx.gbl...
    > Steve G wrote:
    > > Hi All:
    > >
    > > I am having difficulty with manipulating data coming from a form
    > > which is then posted to a database. The from contains a mixture of
    > > check boxes, and a text box for "other" with a default value of NA,
    > > all of which have the same name value of specialty.
    > >
    > > When I complete the form, and send it to a page to post to the
    > > database, a response.write for the form field delivers a comma
    > > delimited list of "items", which is what I expected, such as:
    > > Allergy and Immunology, Anesthesiology, NA
    > >
    > > If the text box is filled in then I would get:
    > > Allergy and Immunology, Anesthesiology, Test
    > >
    > > When the text field is NA, I want to eliminate it from the text
    > > string, so I end up with:
    > > Allergy and Immunology, Anesthesiology
    > > Before splitting on the comma, and posting to the database.
    > >
    > > I can get rid of the NA doing this:
    > > strTemp = request.form("specialty")
    > > strTemp1 = replace(strTemp,"NA"," ")
    > >
    > > This yields:
    > > Allergy and Immunology, Anesthesiology,
    > >
    > > Note the trailing comma..if I leave it in, I get an extra blank
    > > record in the database...but I cannot figure out how to get rid of it.
    >
    > How about:
    > strTemp1 = replace(strTemp,", NA","")
    >
    > Bob Barrows
    > --
    > Microsoft MVP -- ASP/ASP.NET
    > Please reply to the newsgroup. The email account listed in my From
    > header is my spam trap, so I don't check it very often. You will get a
    > quicker response by posting to the newsgroup.
    >
    >

    Steve G Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139