Trimming out the fat..

Results 1 to 5 of 5

Thread: Trimming out the fat..

  1. #1
    Jim Rudnick Guest

    Default Trimming out the fat..

    Hi all..<BR>Wondering if I&#039;m doing this right? When displaying a user car web app onscreen, if I wish to add an item like "miles" to the number stored in the dbase in the MILEAGE field...this &#039;seems&#039; to work fine...<BR><BR> Response.Write(rs.Fields("Mileage") & ("&nbsp;kms.")<BR><BR>But when storing same back into the dbase on the EDIT page, if I just put the contents of that field back, I add the word &#039;miles&#039; over and over again.<BR><BR>Cutting out the &#039;miles&#039; from the content to be put back entails using REPLACE(stringName, "miles", "") where I just put nothing into that spot. This too &#039;works,&#039; but I&#039;m a little antsy.<BR><BR>Will this cause problems? If so, why and how do I get around this?<BR><BR>Jim<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Trimming out the fat..

    first of all, the code:<BR><BR>Response.Write(rs.Fields("Mileage") & (" kms."))<BR><BR>doesn&#039;t do ANYTHING to the database - it displays a string<BR><BR>secondly, how are you "put[ting] the contents of that field back"?

  3. #3
    Heaven's Martini Guest

    Default lyposuction

    why are you "antsy" about that? whatever the heck "antsy" means.<BR><BR>are you typing in the miles part? if not, why not force the user to type in a number and give them a dropdown of the possible units of measure, if you are the one hardcoding in the miles part, using instr will work fine. <BR><BR>missing the issue here, but then again its tuesday.

  4. #4
    Reggie Guest

    Default Huh?

    Replace() uses a lot of server resources, but I can&#039;t figure out what you are doing. Are you storing the mileage in only km, only miles, or both? Use some dropdown boxes to moderate what users can enter.

  5. #5
    Jim Rudnick Guest

    Default RE: Huh?

    (Editorial Aside for Heaven&#039;s Martini...<BR><BR>Merriam-Webster Collegiate Dictionary<BR><BR>One entry found for "antsy"<BR><BR>Main Entry: ant┬Ěsy <BR>Pronunciation: &#039;ant-sE<BR>Function: adjective<BR>Date: 1838<BR>1 : impatient of restraint; especially : FIDGETY<BR>2 : NERVOUS, APPREHENSIVE )<BR><BR>Hello All...<BR><BR>I guess I didn&#039;t put my concerns in enough detail, so here goes...<BR> <BR>I can show the number of miles a used car has by simple polling the dbase field and adding the plain english text "miles" after the number is displayed just fine.<BR><BR>But as this is an edit page, where the Admin can change any of the 160+ items that are qualified for each vehicle (like Power steering or Dual Exhausts etc. etc.) when I put that value back into the dbase, from it&#039;s onscreen place using...<BR><BR>&#060;INPUT TYPE="text" NAME="txtMileage" SIZE="9" value=&#060;%= Response.Write(rs.Fields("Mileage") & ("&nbsp;kms."))%&#062;&#062;<BR><BR> automatically writes that "miles" again, and again and again each time into the dbase when the Admin clicks on the submit button. That is, I&#039;d get 31,000 miles miles miles if the Admin had updated that car 3 times...see the problem now?<BR><BR>I can stop that by using the REPLACE(stringName, "miles", "") item, where I replace that "miles" with nada (Attention: Heaven&#039;s Martini, this is Spanish for nothing!)<BR><BR>What I am asking is, IS this the best way to cut superfluous items from data that is to be stored in a dbase? Is there another or better way, I don&#039;t know, hence my &#039;antsy&#039; feelings.<BR><BR>Can anyone help here?<BR><BR>Jim

Posting Permissions

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