Wiki Home

Msde Vfp 101

Namespace: VB
Msde Vfp 101 - a WNL by Carl Karsten

A simple hands on example of using MSDE (or any back end really) with VFP. If time permits, we can talk about setting up the server and the few limitations of MSDE.
This should help VFP'ers make the jump from DBF's to MSDE.
Here is what we will do:
  1. Make a VFP remote view
  2. Make a CRUD form based on the view.
  3. Add some data.
  4. Import some data.
  5. See how the simple view isn't to good when you have lots of data.
  6. Make a better view.
  7. Make a view that works the server a bit
  8. See what degridation is like when everyone works the server a bit.

This is not Msde Setup - that is either as easy as the wiki page, or a bit of a pain that I still don't have enough answers for.
You will need the Ms SQL driver installed on your machine. You should/could have installed that as part of the VFP install, SP3 I think. If not, get MDAC 2.5 from
Here is how I set up the server we will be using. I ran this VFP program to create the database and table: _ Msde Vfp 101_1
You don't need this for the demo - we will be using my server.
Make a directory like c:\wnl\msdevfp (or what ever you want) and put any files you create in it.
  1. Make a VFP remote view. cut/paste _ Msde Vfp 101_2 into mkdbc.prg and run it.
  2. Make a simple CRUD form based on the view and let everyone add some data, or download it.
    • CREATE FORM frmAddr
    • Add the view to the form's Data Environment (DE)
    • Select all fields and right-drag them to the top of the form, pick "create multiple controles".
    • Resize the form so you can see all of them and have room for some buttons.
    • Add buttons with the following captions and click methods: (semicollon represents a new line)
      • New, APPEND BLANK; thisform.Refresh(); thisform.txtCfnam.SetFocus()
      • Save, tableupdate()
      • Undo, tablerevert()
      • Previous, if !bof(); skip-1; thisform.Refresh(); endif
      • Next, if !eof(); skip; thisform.Refresh(); endif
      • Delete, delete; tableupdate(); thisform.Refresh()
      • Cancel, thisform.release()

  3. Import some data - few hundred records should do. I'm sure everyone has a name/address list handy. Example: _ Msde Vfp 101_3
  4. See how the simple view isn't to good when you have lots of data
  5. Make a better view
  6. Make a view that works the server a bit
  7. See what degridation is like when everyone works the server a bit.

Debugging: _ Msde Vfp 101_4
Chat: _ Msde Vfp 101 Chat
Q: Does the delete need a requery()? - ?CFK
A: No, but you need a TableUpdate().
TableUpdate() is used to send your modifications (including added and deleted records) to the backend, see the VFPHelp for the options.
Requery() is used to get the current data from the backend. -- Frank Camp
Q: Is MS going to release a version of MSDE that is compatible with SQL 2000? -- Dan Jurden
A: Yes. It is called SQL Personal Edition 3(?) - see and - ?CFK

A2: There is MSDE2000 on my MS Office XP CD !!!! - Josko Martinac
A3: VFP7 & VFP8 includes MSDE2000 in the box! -- Esparta Palma
you can download or order the eval of sql2000, which includes MSDE8 from
Category MSDE
( Topic last updated: 2003.03.29 01:03:17 AM )