Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Table Problem

Status
Not open for further replies.

mpdillon

Programmer
Jan 27, 2004
18
0
0
US
Hi,
I am having difuculty creating a new table in VB6. I am trying to create a Free table, with the following code.

Create Table Combo (JobNo char(10), Phase char(10), CostCd Char(10))

When this is executed an error is returned. "Function not supported for non-.DBC..." (Not the exact verbage)

The database connection is valid as I can open and browse tables.

I can seem to find the cause of the error. Any help would be appreciated.

thanks,
pat

FYI, last night was the first time I have ever seen VFP. However, I am fairly proficient in VB and SQL server.
 

Well, I've never created tables from VB, but in VFP, the syntax is

Create Table Combo (JobNo C(10), Phase C(10), CostCd C(10))

Note one letter only for the field types.
 

Actually, your CREATE TABLE is perfectly valid. Stella is right when she says that in VFP we use C instead of Char for the data types (e.g C(10) rather than Char(10)). But VFP supports Char as well.

The only thing I can think of that would cause that error is if some of the field names exceeded ten characters, but that's not the case in the code you posted.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 

I guess, this was the error you have seen:
Code:
[b]Feature is not supported for non-.DBC tables (Error 1580)[/b]
You have tried to implement a feature, such as a nullable field, a primary key, a persistent relation, a default value, a validation rule, or a trigger, on a free table. These features are available only for tables that are contained in a database (.dbc).

I also don't see in this statement anything not supported for free tables, but can you show a little more of the surrounding code?

By the way, was there any database open at the time when you tried to create the table?
 
Stella704pl,
You diagnosed it. Not shown in my code above was the phrase "Primary Key"(I created this post from memory the day after I had the problem.). When I remove the "Primary Key" phrase, everything works fine. Thank you for your effort.
How did you get the detail for that message?

PS either c(10) or Char(10) seems to work.
 

How did you get the detail for that message?

There is a topic in VFP Help, "Error Messages A-Z"

By the way, you could have gotten it if you pressed "Help" button right in the error message when you got it.

Also, if you go to the Help topic "CREATE TABLE – SQL Command", you can find there more detailed information on what's supported and what's not on free tables and database tables.

For the future, please post all the code/error message relevant to the question. It makes it easier to diagnose and cure the problem.

Glad it works now.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top