SQL Help

Discussion in 'Software' started by NeoNemesis, Nov 10, 2004.

  1. NeoNemesis

    NeoNemesis Moutharrhea

    I've put together a simple guestbook where people can put there name down and it records their name to a database. but i have a problem. how do i make it so that it will only add it if someone actually puts a value down. What i mean is, i dont want blank entries. because then i can't delete them.

    if you go here:

    http://m.1asphost.com/desmondp/guestbook/view.asp

    you will notice that two up from the bottom there is a blank entry where someone just put a space and then added their name, and it left the date. well i can't delete it now because it doesn't have any values. so is there a way to make it so it will only add the name if there is a value for it?
     
  2. IdahoGeek

    IdahoGeek Private E-2

    Is there anyway in SQL to make this a required field. That way before the system actually does the update an Error message will come up if the field is Null.
     
  3. NeoNemesis

    NeoNemesis Moutharrhea

    What if the person just like puts in a space, will it block it then?
     
  4. IdahoGeek

    IdahoGeek Private E-2

    If in SQL you can alter the properties of the field, Then a "Space" will be a null entry and prompt the user to enter something in the field. Of course some fool could always put in a single letter or number.

    Another thought is to write a routine that simply deletes any entry that is blank or a null after you pull the data off the site. I would gather you are getting these names for a reason. So in your Data Processing just eliminate them. Or do I not understand what it is you are doing?? :confused:
     
  5. NeoNemesis

    NeoNemesis Moutharrhea

    basically im still new with sql and asp, and so this simple guestbook was my first creation. its not much but in my efforts to improve upon it i thought i would make a validation. i get what your sayin though. its not like im giong to have this happen all the time so its not a big deal really. but it would be nice to get rid of some of them.
     
  6. Kodo

    Kodo SNATCHSQUATCH

    just do this..
    guestname=trim(replace(request.form("guestname"),"'","''"))

    if guestname='" then
    guestname="Anonymous"
    end if

    then just pass guestname to the query. problem solved.
     
  7. NeoNemesis

    NeoNemesis Moutharrhea

    thanks guys but i got some javascript code from animator strike and it works well. so im gonna go ahead and use that.
     
  8. Kodo

    Kodo SNATCHSQUATCH

    word to the wise.. client side is only 50% of it. if javascript is disabled.. guess what..
     
  9. NeoNemesis

    NeoNemesis Moutharrhea

    lol yeah i know what ya mean i didn't think about that. but i mean considering the only ppl viewing this is anyone that reads my aim profile which are ppl from school who kno nothing about computers, im assuming they wouldn't be smart enough to disable javascript just for this. but i will remember that for any bigger projects that come up.
     

MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds