Results 1 to 5 of 5

Thread: [RESOLVED] Open/read/add data from a DBF File

  1. #1

    Thread Starter
    Member
    Join Date
    May 2006
    Posts
    40

    Resolved [RESOLVED] Open/read/add data from a DBF File

    Hi Everyone,

    I need to open a DBF file in vb, read the contents of a column (which is a name of a file), search for that file, and if the file exists or not, place either a yes or no in a new column stating if the file exists or not.

    Any suggestions on where to start?

    PS...I'm kind of a noob to vb...

  2. #2
    Addicted Member cha0s4u's Avatar
    Join Date
    Apr 2005
    Location
    new Delhi - 1ND1A
    Posts
    209

    Re: Open/read/add data from a DBF File

    I dont think that would be a problem if there is an OLEDB Provider for DBF files.
    BTW .. what creates a DBF File???
    - cha0s4u ENJOI

    Do Remember to RATE a post if it helps u,
    Ratings encrougage those who Know enough,to help others

  3. #3

    Thread Starter
    Member
    Join Date
    May 2006
    Posts
    40

    Re: Open/read/add data from a DBF File

    Apparently Microsoft Jet Engine 4.0 handles DBF files.

    The files hold the non-spatial information from a shapefile from ESRI.

    Any suggestions?

  4. #4
    Hyperactive Member
    Join Date
    Jun 2006
    Posts
    396

    Re: Open/read/add data from a DBF File

    If the Jet engine handles DBF files then your code could look something like this...
    VB Code:
    1. Dim myRecordSet As ADODB.Recordset  
    2. Dim MySQL As String    
    3. MySQL = "Select File_Column, YesNo_Column FROM yourTable"  
    4. Set myRecordSet = New ADODB.Recordset  
    5. myRecordSet.Open MySQL, yourConnectionString, ,AdlockOptimistic , adCmdUnknown    
    6.  
    7. While myRecordSet.EOF = False    
    8.    If Your_Test_For_File_Function(myRecordSet("File_Column")) = True Then        
    9.        myRecordSet("YesNo_Column") = "YES"    
    10.    Else        
    11.       myRecordSet("YesNo_Column") = "NO"    
    12.    End if    
    13.  
    14.    myRecordSet.UpDate    
    15.    myRecordSet.MoveNext  
    16. Wend        
    17.  
    18. myRecordSet.Close

  5. #5

    Thread Starter
    Member
    Join Date
    May 2006
    Posts
    40

    Re: Open/read/add data from a DBF File

    Works great, thanks a bunch!!

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