Results 1 to 8 of 8
  1. #1
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Delete all records based value... (6.0)

    Try

    With CNSQL
    .Execute "DELETE SCHEDA.* FROM SCHEDA WHERE PROVA1 = '" & PARAM_1 & "'"
    End With
    Regards
    John



  2. #2
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Delete all records based value... (6.0)

    I use the tipical conn with ADO and SQL Express.
    Now i want to delete all records (See image) based value in field PROVA1...
    I use this code but have a dubt?! peraphs i can use "*" to select all records????

    in this case PARAM_1="05018370A"

    With CNSQL
    .Execute "DELETE FROM SCHEDA WHERE PROVA1 = '" & PARAM_1 & "'"
    End With

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete all records based value... (6.0)

    I use the tipical conn with ADO and SQL Express.
    Now i want to delete all records (See image) based value in field PROVA1...
    I use this code but have a dubt?! peraphs i can use "*" to select all records????

    in this case PARAM_1="05018370A"

    With CNSQL
    .Execute "DELETE FROM SCHEDA WHERE PROVA1 = '" & PARAM_1 & "'"
    End With

  4. #4
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete all records based value... (6.0)

    dubt... because have error !
    1) but the com near SCHEDA is required? you have post SCHEDA. and not SCHEDA
    2) see the error in image

    With CNSQL
    .Execute "DELETE SCHEDA.* FROM SCHEDA WHERE PROVA1 = '" & PARAM_1 & "'"
    End With

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Delete all records based value... (6.0)

    The line

    .Execute "DELETE FROM SCHEDA WHERE PROVA1 = '" & PARAM_1 & "'"

    should delete all records for which PROVA1 equals the value of PARAM_1.

  6. #6
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete all records based value... (6.0)

    Hi...
    But have a dubt...
    If PARAM_1 not is found whats up???
    or...
    before to use the sql is correct to use a condition similar:
    if rsest found then
    sql
    else
    ...
    end if

    ????

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Delete all records based value... (6.0)

    If there are no records for which PROVA1 is equal to the value of PARAM_1, the line

    .Execute "DELETE FROM SCHEDA WHERE PROVA1 = '" & PARAM_1 & "'"

    won't do anything; it will not cause an error either.

  8. #8
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Delete all records based value... (6.0)

    OK now is clear..
    Tks.

Posting Permissions

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