DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Delete record from .DBF using ADO

Hybrid View

  1. #1
    Ted Young Guest

    Delete record from .DBF using ADO


    Is it possible to delete a record from a .DBF file using ADO?
    I am able to connect to the table/db using the code below. But when the
    DELETE method executes I am getting an error message stating "Query Based
    Delete Failed. The row to delete could not be found"
    I know the result set found the entry becuase EOF is false and the recordcount
    is 1.Any ideas would be GREATLY appreciated.Thanks!
    objWHSConn.ConnectionString = "DRIVER=Microsoft Visual FoxPro Driver (*.dbf);UID=;Deleted
    = Yes;Null=Yes;Collate = Machine;BackgroundFetch = Yes;Exclusive = No;SourceType
    = DBF;SourceDB=c:\WHS"objWHSConn.Open
    objWHSRS.Open "SELECT * FROM WHS WHERE Loan_No ='" & strLoanNumber & "'",
    objWHSConn, adOpenStatic, adLockBatchOptimistic
    objWHSRS.Filter = "Loan_No ='" & strLoanNumber & "'"objWHSRS.Delete
    objWHSRS.UpdateBatch

  2. #2
    Ted Young Guest

    Re: Delete record from .DBF using ADO


    I was able to get a SELECT statement to work but not a DELETE statment with
    the connection object. I am getting an error that states "[ODBC Visual FoxPro
    Driver] Command contains unrecognized keyword"

    Any ideas?

    'DOES NOT WORK
    objWHSConn.Execute "DELETE * FROM WHS WHERE Loan_No ='" & strLoanNumber &
    "'"

    'DOES WORK
    objWHSConn.Execute "DELETE * FROM WHS WHERE Loan_No ='" & strLoanNumber &
    "'"




    "Ted Young" <tyoung@mlnusa.com> wrote:
    >
    >Is it possible to delete a record from a .DBF file using ADO?
    >I am able to connect to the table/db using the code below. But when the
    >DELETE method executes I am getting an error message stating "Query Based
    >Delete Failed. The row to delete could not be found"
    >I know the result set found the entry becuase EOF is false and the recordcount
    >is 1.Any ideas would be GREATLY appreciated.Thanks!
    >objWHSConn.ConnectionString = "DRIVER=Microsoft Visual FoxPro Driver (*.dbf);UID=;Deleted
    >= Yes;Null=Yes;Collate = Machine;BackgroundFetch = Yes;Exclusive = No;SourceType
    >= DBF;SourceDB=c:\WHS"objWHSConn.Open
    >objWHSRS.Open "SELECT * FROM WHS WHERE Loan_No ='" & strLoanNumber & "'",
    >objWHSConn, adOpenStatic, adLockBatchOptimistic
    >objWHSRS.Filter = "Loan_No ='" & strLoanNumber & "'"objWHSRS.Delete
    >objWHSRS.UpdateBatch



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center