I just took over at a new company that originally used dbase to build some processes/reports and later converted it all into VFP 7.0. However, I noticed in looking at the VFP projects, that no database files were used and therefore, there are no primary keys established and/or relationships defined. In addition, there are no views used in any of the projects since those are only supported when using a database file

Being a beginner to VFP and programming (8 years using Access only), can anyone give me some thoughts on why you would use a database file and why you wouldn't?? To me, having primary keys is critical to data integrity so I'm not sure why they weren't used. However, the old manager learned VFP from a book and didn't have a lot of dbase experience so that would explain why. Is using a database file important and/or critical?? Thanks.

RE: Beginner to VFP by Leemi

Leemi
Tue May 18 13:32:42 CDT 2004

Hi:

As you know, it can be somewhat difficult to speculate why someone did one
thing or another. <s> However, I will offer a few ideas.

You use a table when you want to keep the data after you exit the program.
If you use a cursor to store the data, the data is lost when you exit the
app because the cursor resides in RAM. Other than that point, you can use a
table and a cursor interchangeably.

By the way, you said you don't see the tables listed in the project. In
VFP, a project does not have to contain any tables. I think this is a key
difference between VFP and Access. Correct me if I am wrong, but I think
all code and data needs to be in an Access project. Not so in VFP. You
need to search the hard drive for table files (DBF, FPT) to see if any
exist. I cannot imagine someone writing a VFP app that uses non tables,
but I guess it is possible.

They might be using unique index keys instead of primary index keys.
However, you are right in stating a primary key is a better option.

I hope this helps.

This posting is provided "AS IS" with no warranties, and confers no rights.

Sincerely,
Microsoft FoxPro Technical Support
Lee Mitchell

*-- VFP8 HAS ARRIVED!! --*
Read about all the new features of VFP8 here:
http://www.universalthread.com/VisualFoxPro/News/VFP8Release.asp
Purchase VFP8 here:
http://shop.microsoft.com/Referral/Productinfo.asp?siteID=11518

Keep an eye on the product lifecycle for Visual FoxPro here:
http://support.microsoft.com/default.aspx?id=fh;[ln];lifeprodv
- VFP5 Mainstream Support retired June 30th, 2003
- VFP6 Mainstream Support retires Sept. 30th, 2003

>I just took over at a new company that originally used dbase to build some
processes/reports
>and later converted it all into VFP 7.0. However, I noticed in looking at
the VFP projects, that no
>database files were used and therefore, there are no primary keys
established and/or
>relationships defined. In addition, there are no views used in any of the
projects since those are
>only supported when using a database file.

>Being a beginner to VFP and programming (8 years using Access only), can
anyone give me
>some thoughts on why you would use a database file and why you wouldn't??
To me, having
>primary keys is critical to data integrity so I'm not sure why they
weren't used. However, the old
>manager learned VFP from a book and didn't have a lot of dbase experience
so that would
>explain why. Is using a database file important and/or critical?? Thanks.


Re: Beginner to VFP by Rush

Rush
Tue May 18 14:27:18 CDT 2004


"Lee Mitchell" <Leemi@online.microsoft.com> wrote in message
news:HUIHDaQPEHA.3080@cpmsftngxa10.phx.gbl...
> Hi:
>
<snip>
>
> By the way, you said you don't see the tables listed in the project. In
> VFP, a project does not have to contain any tables. I think this is a key
> difference between VFP and Access. Correct me if I am wrong, but I think
> all code and data needs to be in an Access project. Not so in VFP. You
> need to search the hard drive for table files (DBF, FPT) to see if any
> exist. I cannot imagine someone writing a VFP app that uses non tables,
> but I guess it is possible.

I think that he meant that there were no databases (DBCs), not that there
were no tables.

> They might be using unique index keys instead of primary index keys.
> However, you are right in stating a primary key is a better option.

Let's hope not - Unique keys are quite different than Primary (or Candidate)
keys. In fact, they shouldn't be used at all - they can lead to erroneous
results.

- Rush



Re: Beginner to VFP by Rush

Rush
Tue May 18 14:29:26 CDT 2004

Views do require a DBC to live in, but they can reference tables (including
pre-VFP versions) that are not part of the DBC.

- Rush

"James LaChance" <anonymous@discussions.microsoft.com> wrote in message
news:7C1DAB0F-296B-4152-A46F-58C31C6FED0B@microsoft.com...
> I just took over at a new company that originally used dbase to build some
processes/reports and later converted it all into VFP 7.0. However, I
noticed in looking at the VFP projects, that no database files were used and
therefore, there are no primary keys established and/or relationships
defined. In addition, there are no views used in any of the projects since
those are only supported when using a database file.
>



Re: Beginner to VFP by Cindy

Cindy
Tue May 18 16:33:31 CDT 2004

In news: 7C1DAB0F-296B-4152-A46F-58C31C6FED0B@microsoft.com,
James LaChance <anonymous@discussions.microsoft.com> wrote:

Hi James,

Welcome to the Fox!

> I just took over at a new company that originally used dbase to build
> some processes/reports and later converted it all into VFP 7.0.

My guess is that the tables are kept in Fox2x format because they were
originally developed with Dbase and the old and new apps had to share the
tables, at least for a while.

> However, I noticed in looking at the VFP projects, that no database
> files were used and therefore, there are no primary keys established

Primary keys can be generated by calling a function, but "housekeeping" must
be coded in every situation that adds a record to the table. Just because
there isn't an auto-incrementing data type doesn't mean there can't be
primary keys in the table.

> and/or relationships defined.

Relationships can be set at runtime if it's important to use them. There are
many ways to handle data that don't involve persistent relationships.

> In addition, there are no views used
> in any of the projects since those are only supported when using a
> database file.

You're right that you have to have a DBC to use views, but having views is
not necessary in an app.

> Being a beginner to VFP and programming (8 years using Access only),
> can anyone give me some thoughts on why you would use a database file
> and why you wouldn't?? To me, having primary keys is critical to
> data integrity so I'm not sure why they weren't used. However, the
> old manager learned VFP from a book and didn't have a lot of dbase
> experience so that would explain why. Is using a database file
> important and/or critical??

DBC's do lots of wonderful things, but with good design and careful coding
you can have everything you need without using them.

--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
cindy.winegarden@mvps.org www.cindywinegarden.com