×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

COM Objects for Fox Pro

COM Objects for Fox Pro

COM Objects for Fox Pro

(OP)
Hi there,

I am programming in VBScript and was wondering if there are COM objects for fox pro that can be used to query a database and retrieve information from a table. If there are COM objects where can I get some documentation on them? Thanks
David

RE: COM Objects for Fox Pro

Hi David,

The answer to your question is yes, VFP is exposed via COM. You can find documentation in the VFP help file, programmer's guide, or MSDN. The methods you will be most interested in are:

DataToClip-This method allows you to place X number of records to the clipboard.
DoCmd-This method executes a native VFP command.
Eval-This method evaluates a VFP expression and returns the result.
RequestData-This method returns data in an array for the number of records you specify.

Here's an example:

*create the server
oVFP=CreateObject('VisualFoxPro.Application')
*open your table
oVFP.DoCmd('USE MyTable')
*return the first record in an array
MyArray=oVFP.RequestData('MyTable',1)
*place the first record in the clipboard
oVFP.DataToClip('MyTable',1)
*return a specific record
MyVar=oVFP.Eval('MyTable.MyField')

One thing to remember. If you're going to automate VFP, it has to be installed on that machine. So if this is a distributed app, this isn't feasible, AFAIK. That is, unless your clients have VFP, and that's highly unlikely.

You may wanna look into using VFP's ODBC drivers. For an example, check the FAQ area of this forum, FoxDev's FAQ will get you going in the right direction.

Jon Hawkins
jonscott8@yahoo.com

Carpe Diem! - Seize the Day!

RE: COM Objects for Fox Pro

If you were using DCOM, VFP wouldn't necessarily need to be installed on the machine running the VBScript - but it would certainly have to be installed on the "server" actually running the instance of VFP.

Robert Bradley

FoxDev - Visual FoxPro Development

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close