Link to home
Start Free TrialLog in
Avatar of JackOfPH
JackOfPHFlag for Philippines

asked on

Programmatically create a dbf database...

How to create a dbf file, programmatically?
Avatar of tusharkanvinde
tusharkanvinde
Flag of India image

check out the CREATE TABLE command

CREATE TABLE TableName (SomeField AutoInc, SomeOtherField C(40), .....)
Avatar of JackOfPH

ASKER

Can you elaborate what you mean?
Are you using VFP or are you using .NET as your front end?

Avatar of Cyril Joudieh
To create a database:
CREATE DATABASE [DatabaseName | ?]

To create a table in the database:
CREATE TABLE | DBF TableName1 [NAME LongTableName] [FREE]
    [CODEPAGE = nCodePage]
    ( FieldName1 FieldType [( nFieldWidth [, nPrecision] )] [NULL | NOT NULL]
    [CHECK lExpression1 [ERROR cMessageText1]]
    [AUTOINC [NEXTVALUE NextValue [STEP StepValue]]] [DEFAULT eExpression1]
    [PRIMARY KEY | UNIQUE [COLLATE cCollateSequence]]
    [REFERENCES TableName2 [TAG TagName1]] [NOCPTRANS]
    [, FieldName2 ... ]
    [, PRIMARY KEY eExpression2 TAG TagName2 |, UNIQUE eExpression3 TAG TagName3
    [COLLATE cCollateSequence]]
    [, FOREIGN KEY eExpression4 TAG TagName4 [NODUP]
    [COLLATE cCollateSequence]
    REFERENCES TableName3 [TAG TagName5]] [, CHECK lExpression2 [ERROR cMessageText2]] )
    | FROM ARRAY ArrayName

You can create a table without creating a database and it will be detached.

These are from the Help in FoxPro.
so I  will just execute this query and then the dbf are created?
CREATE TABLE Mytable (strngfield C(10), datefield D, memofield M, numfield N(10,2), ...)
INDEX ON datefield TAG datefield
INDEX ON strngfield TAG strngfield

This is how you create a table and index it from within FoxPro.

If you are doing it from .Net I don't know how. But I don't under why you would use a tool like .Net if you have FoxPro :-D.
I don't have fox pro installed... My client just requires us that instead of the output textfile, the output is in foxpro.

But I don't under why you would use a tool like .Net if you have FoxPro
ASKER CERTIFIED SOLUTION
Avatar of JackOfPH
JackOfPH
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
With FoxPro you can manipulate data much easier than in .Net. That's why I said better in FoxPro than in .Net.
@ramrom,

Hey! Watch your word! I tried to be specific in my question...

And I am not wasting YOUR VALUABLE TIME EITHER!!!
@ramrom,

Also note, does finding the answer to my own questions, is a form of wasting Your precious time? or the time of the experts here?

I don't think so...

Jack
Jack, it was not clear what you exactly wanted. Your question can be answered in so many different ways.

Also there is a difference between a query and a command.
If the question is unclear then you can ask the author to clarify things... right?

I myself while answering other questions, if the question is unclear then I will ask the author to further explain the question so that me, and other experts here in this site, can help the author determine or find the answer appropriate for him or her.

The experts that participated in this thread never ask for any clarification, that is why I thought that my question is very clear.

>>That delays your getting the answer you want and wastes our time.

I just disappointed about ramrom, commented about wasting the time of experts here...

As a site administrator you should not commented that way!!!

Does his action is right by saying that I just waste the time of the experts here?



***Note***

In almost nine years of using experts-exchange, I never had any intention to waste the time of those who wants to participate or help me find the answer to my question...

You can see that I was trying to answer your questions as much as I understood them.

You should have mentioned you don't have FoxPro installed and if you were trying to create database or a free table dbf. In the past a table was called database.

Anyway, what has happened has happened :-)
ok, but please, next time, don't put this line again...

>>That delays your getting the answer you want and wastes our time.

Note:

1.) ASK for clarification if the question is not clear.
2.) Even if you are moderator or an administrator, you should never use foul words because you might drive away a person for asking questions again.
 

Well Jack, there are a few Experts who got tired from certain askers and I for one refuse to answer two askers because they are never clear and they never treat us fairly. Some of these Experts stopped their activity on EE if you have noticed. I understand ramrom. He did not use foul words.

He is just saying when you don't write your answer clearly, you will delay getting your answer and wasting our time and yours. Don't take it personally :-).

I am only trying to say that you should be careful what you post...

because he post

>>That delays your getting the answer you want and wastes our time.

and not what you have said:

"you will delay getting your answer and wasting our time and yours"
No one is questioning your intentions. No one is saying "you waste our time".

I am just asking you to give enough information so we know how to answer.

I am sorry that my comments were upsetting for you. That was not my intention.

You say "The experts that participated in this thread never ask for any clarification"

tusharkanvinde attempted to obtain more information from you by asking "Are you using VFP or are you using .NET as your front end?" That was a request for clarification! Perhaps it would have been better if he had asked "What are you using as your front end?" or "What are you programing in?"

It appears that you are using VB. Had you stated so initially or in response to tusharkanvinde's query we could have given you the answer quickly.