Solved

DBF

Posted on 2004-10-21
474 Views
Last Modified: 2010-04-04
Heeeeelow :)

i'm creating and connecting to DBF files

Here is my problem when i open created file colum name is interesting XCOLUMNAME_ why there is 'X' and '_'

my coneection string
Provider=MSDASQL.1;Persist Security Info=False;Data Source=dBASE Files;Initial Catalog=C:\TEMP

i thout it is ADO who dousn't understand DBF file, but when i open it with MSExcel or DateBase desktop its the same XCOLUMNAME_

thx..
0
Question by:Kristao
    5 Comments
     
    LVL 11

    Expert Comment

    by:calinutz
    my dbf files do not look like that when I open them with Excel. The column names are ok.
    What version of Fox did you use to create the dbf?
    0
     

    Accepted Solution

    by:
    Hi,

    Could you tell, how do you create these files?
    I suggest you to use BDE componets to create
    and access to DBF files:

    Add these components to your form or data module:

    Database: TDatabase;
    Query: TQuery;

    Procedure CreateDBF(FilePath, FileName: string);
    Begin
      Database.Params.Add('PATH=' + FilePath);
      Database.DatabaseName := 'AnyName';
      Database.Connected := True;
     
      Query.DatabaseName := 'AnyName';
      Query.SQL.ADD('CREATE TABLE "FileName" (Column1Name DataType1, ColumnName2 DataType2, [ColumnNameN DataTypeN)');
      Try
        Query.ExecSQL;
      Except
        ShowMessage('File probably already exists');
      End;
    End;

    Procedure CallFileCreation;
    Begin
      CreateDBF('C:\Temp', 'anyfile.dbf');
    end;

    If you don't know, how to access to DBF files, I could help you.
    Just let me know.

    Bye
    0
     
    LVL 1

    Author Comment

    by:Kristao
    ADO is much better than DBE and DBE needs to have instalation pack to run it on some other computer :|.

    Hey calinutz what did u wrote in connection string? and how did u made expresion to make DBF file with ADO?

    this is what i wrote in adoquery

    CREATE TABLE 321.DBF
    (
    '3' VarChar (25)
    )



    0
     
    LVL 17

    Expert Comment

    by:Wim ten Brink
    > i thout it is ADO who dousn't understand DBF file, but when i open it with MSExcel or DateBase desktop its the same XCOLUMNAME_

    Well, let me say something simple to you... The field is just called XCOLUMNAME_ so ask the person who created that table why he did it. He must have had some reason for it. It's not a bug.

    And one more thing... Fieldnames CANNOT be numeric values! Change it to:

    CREATE TABLE 321.DBF
    (
    'F3' VarChar (25)
    )

    Fieldnames cannot start with a number and neither can they be numeric... And there are a few other limitations too.
    0
     
    LVL 1

    Author Comment

    by:Kristao
    i'm creating that programm :P
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
    Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    884 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now