[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 483
  • Last Modified:

DBF

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
Kristao
Asked:
Kristao
1 Solution
 
calinutzCommented:
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
 
DynamicMonsieurCommented:
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
 
KristaoAuthor Commented:
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
 
Wim ten BrinkSelf-employed developerCommented:
> 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
 
KristaoAuthor Commented:
i'm creating that programm :P
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now