locked
Create or adit dbf file

    Question

  • Hi,

     

    I want to create a dbf file using vb and i want to edit existing dbf files.

    Does anyone know how to do this? What is the best way?

     

    Thanks,

     

    Bas

    Saturday, January 19, 2008 10:55 AM

Answers

  •  

    Ok, I became curious and did a DIR/S *.dbf on my system. I found that Real Player uses .dbf files so I made a copy of a .dbf file and brought VS2008 up and was able to connect to to that file using the Server Explorer after creating a new server explorer connection.

     

    Once I connected, under Main Menu | Data, I was able to bring up the T-SQL Editor and examine the tables. I don't know how much of this you will be able to do because I use a paid for version of VS2008 and I have SQL-2008 beta installed.

     

    But following these steps should get you underway.

     

    Vista

    VS2008 Team Suite

    Sunday, January 20, 2008 4:48 PM
  •  

    Bass,

     

    When I played with it, the designer was fully able to open the tables on a Real Player .dbf file.

     

    Yes, there are lots of ways to do this and I saw the same thing you did. Yet I know.... VS2008 can read the data in a table. If that's so you can manipulate what ever you like and the only challenge may be to write the file.

     

    Why? Because as i noted I don't have any ODBC experience. Here is how I would proceed....

     

    Use ODBC to read your table. That's your first task. Once you get that far you'll able to do whatever you need with System.Data. The all you'll have to do is update the table. It should be rather straight forward.

     

    Form a connection

    Open it

    read the table into memory.

     

    those are your next steps.

     

     

    Tuesday, January 22, 2008 8:44 PM

All replies

  • What version are these files?

    Saturday, January 19, 2008 3:05 PM
  • I'm sorry. I use vb 2008 express edition.

    And I think the dbf file is dBase3

     

    If i can edit the file (empty add records etc.) I'm happy enough Smile

     

    Thanks

    Saturday, January 19, 2008 4:45 PM
  • In Administrative Tools.... Under Datasources, to begin with see if you can connect to your database with the Dbase V3 files.

     

    I don't have any ODBC experience, but I will do what I can to help you.

    Saturday, January 19, 2008 6:51 PM
  •  

    there are three choices for a connection:

     

    - Microsoft Acces database file;

    - Microsoft SQL server compact 3.5;

    - Microsoft Server database file.

     

    None of them works (expected).

     

    I found on the net that I have to install Microsoft OLE DB Provider for Visual FoxPro 9.0 to connect to a dbf file.

    I did that and I made a reference to vfpoledb.dll (Project -> add reference -> C:\Program Files\Common Files\System\Ole DB)

     

    I was hoping to see another option in the "change data source" dialogbox (data connections -> add connection -> change..)

    But that was'nt the case.

     

    I'm a totall newbie so I dont no if i am on the right track.

     

    Greetz,

     

    Bas

     

     

     

     

     

     

     

    Sunday, January 20, 2008 1:58 PM
  •  

    Goodness, What version of Windows are you running?

     

    I don't have a dbf file for testing but with Vista, it looks like dbf files are supported.

     

    There are shareware dbf editors and converters. I think it may be a good idea to convert your dbf file to Compact SQL especially if you are just starting to write an application.

    Sunday, January 20, 2008 2:24 PM
  • I have Windows XP

     

    I can edit the dbf file with openoffice for example, but that is not want i want.

    I want to make an application that directly can edit the dbf file.

     

    My goal is to generate tags from a Siemens PLC source file and put them in the dbf file. The tags in the dbf file are used by a SCADA application in order to communicate with the PLC. I allready can read the source file and generate the tags. I only need to put them in de dbf file.

     

    I want my application to be installed on a computer and do it all for me. I dont want to manually coverts files.

     

    But if it is really difficult to edit a dbf file from visual basic 2008. Is it possible to first convert it to a SQL database, edit, and then convert it back to dbf ? (all by the application offcourse)

     

    Thanks,

     

    Bas

     

     

     

     

     

    Sunday, January 20, 2008 3:18 PM
  • The problem is not with VB. The problem is with the propriety dbf file format and interface for it. The interface is called a driver and it's not a part of Windows.

     

    Obviously it is something that you can buy and install as a dbase component or you could try something like this:

     

    http://www.download3000.com/download_14954.html

     

    The point is, until you can connect and relate to a dbf file, you can't do anything and dbase software is needed to do that and apparently that's intentional.

     

    Looking at Vista when I look at datasources, it clearly lists dbase files and the Microsoft dbase driver with selectable support of dbase III, IV and 5 files, version 600.6000.16386. Perhaps the challenge is to create a database?

    Sunday, January 20, 2008 4:11 PM
  •  

    Ok, I became curious and did a DIR/S *.dbf on my system. I found that Real Player uses .dbf files so I made a copy of a .dbf file and brought VS2008 up and was able to connect to to that file using the Server Explorer after creating a new server explorer connection.

     

    Once I connected, under Main Menu | Data, I was able to bring up the T-SQL Editor and examine the tables. I don't know how much of this you will be able to do because I use a paid for version of VS2008 and I have SQL-2008 beta installed.

     

    But following these steps should get you underway.

     

    Vista

    VS2008 Team Suite

    Sunday, January 20, 2008 4:48 PM
  • I think you have more options because I can't find the server explorer (or you mean database explorer)

    If I try to make a connection I only can choose between .mdb .accdb .mdf and .sdf depending on what kind of data source I select.

     

    But if I am getting you right...If I use Vista and install SQL server 2008 (now have SQL server 2005) I will get an extra data source witch can make a connection to a .dbf?

     

     

    Sunday, January 20, 2008 7:28 PM
  •  

    I was able to fully use Vista with DBF files. The Server Explorer (In Team Suite) does not appear unless you select it in Main Menu | View and then it appears as a selectable vertical tab on the left where the toolbox is.

     

    I think I did load the dbf driver as an ODBC source.in  Datasources under Admin Tools.

     

    I'm pretty sure you can do with XP and VBE. I'm sure I remember using the Server Explorer when I used VBE.

     

     

    Monday, January 21, 2008 12:23 AM
  • So If i download teamsuite (4000 MB ) then I will be able to connect to dbf files?

    And can I import my application project?

    Tuesday, January 22, 2008 6:13 PM
  •  

    All I know is that I had no trouble at all........................

     

    Tuesday, January 22, 2008 6:17 PM
  • Ok thank you. I will start download and see how far I will get.

    I wil let you know how it works for me.

     

    Tuesday, January 22, 2008 6:20 PM
  • Takes me 10 ours to download...too long

     

    I searched the internet and I know it's possible to edit a .dbf in VB 2008 express. It is even possible in 6.0...

    But there like 10.000.000 different ways: ado, odbc,  etc. etc. etc.

    Some say it's not possible, some say you first need to convert to sql, some say...whaaa I'm new to databases so I'm a little confused.

    There are a lot small sample codes, but offcourse I can't just paste them in (error error error).

    I have to know witch dll's I need to download and reference and how to use them, and how to make a connectionstring to the .dbf etc.

    I need something like: "Connecting to a .dbf in Visual Basic for dummys"  

     

    I think I have to let all the information sink in a bit, because I'm seeing double at this moment

     

     

     

     

    Tuesday, January 22, 2008 8:33 PM
  •  

    Bass,

     

    When I played with it, the designer was fully able to open the tables on a Real Player .dbf file.

     

    Yes, there are lots of ways to do this and I saw the same thing you did. Yet I know.... VS2008 can read the data in a table. If that's so you can manipulate what ever you like and the only challenge may be to write the file.

     

    Why? Because as i noted I don't have any ODBC experience. Here is how I would proceed....

     

    Use ODBC to read your table. That's your first task. Once you get that far you'll able to do whatever you need with System.Data. The all you'll have to do is update the table. It should be rather straight forward.

     

    Form a connection

    Open it

    read the table into memory.

     

    those are your next steps.

     

     

    Tuesday, January 22, 2008 8:44 PM
  • I beleive the express edition is limited in its connectivity to datasources....

     

    Create data-enabled applications with the lightweight SQL Server Compact Edition or powerful client/server applications with SQL Server 2005 Express Edition

     

    http://www.microsoft.com/express/vb/default.aspx

     

     

    Wednesday, January 23, 2008 1:24 AM
  • www.softwarescada.com
    www.modbusrtu.com
    Monday, May 4, 2009 1:58 PM