Results 1 to 4 of 4

Thread: [RESOLVED] delete a field contents

Hybrid View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046

    [RESOLVED] delete a field contents

    Why does this delete the contents of all the fields in myTable instead of just the field myField???? How can I delete the contents of a single field using adodb.command??

    VB Code:
    1. Dim cmd As New ADODB.Command
    2. cmd.CommandText = "DELETE myField FROM myTable"
    3. cmd.Execute

    Thanks for any help!!!
    Last edited by Muddy; Aug 7th, 2003 at 06:42 AM.

  2. #2
    Fanatic Member Armbruster's Avatar
    Join Date
    Sep 2002
    Location
    Maryland Heights, MO
    Posts
    857
    Delete is used to delete the entire record

    I think you want something like:


    VB Code:
    1. cmd.CommandText = "UPDATE myTable SET myField =  ' '  "
    "Look! Up in the sky! It's a bird! It's a plane! It's Diaper-Head Boy! (there by my name!) Yes, Diaper-Head Boy, who disguised as my son, Seth, fights a never-ending battle for truth, justice and terrorizing my house!

    Resistance is futile, you will be compiled . . . Please!

  3. #3
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390
    Delete can be used to delete all or a single row

    single row:
    DELETE FROM myTable WHERE MyField = 'whatever'

    or

    DELETE * FROM MyTable (This deletes all!!)

    but if you want to just 'blank out' that field..then use Update
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  4. #4

    Thread Starter
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    Thanks all !

Posting Permissions

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



Click Here to Expand Forum to Full Width