There are two ways it can be done:
1) opening and Using M2M's database container to connect
2) creating the ODBC connection on the computer directly to the
database...
=== For Option 1: ===
You can try this on the VFP Command line, or open it from within a
program:
-> set excl off
-> open data m:\m2mdata\data01\m2mdata
-> conhandle = SQLConnect('MainConnection')
-> ? conhandle
If you see a 1 on the main VFP window, you successfully connected to the
database. You can now run queries like:
-> sqlexec(1,[select * from inmast where fpartno =
'partnumber'],'tempcursor')
=== For Option 2: ===
First you would need to create the ODBC connection on the computer itself To
the database before you can access it via VFPs (or VBs) sqlexec(): (It looks
long but its actually super simple to do once you've done this enough times)
Heres my setup for example: My M2M server is "mrpserv", my SQL database is
"m2mdata01"
1) Open up the Control Panel, go into your Administrative tools, and
double-click Data Sources (ODBC).
2) click Add to add a new User DSN
3) scroll to the bottom, click SQL Server, click Finish to start configuring
the connection...
4) The name can be anything you want (in my case m2mdata01), the Server is
your SQL server (in my case MRPSERV). Click Next.
5) The server will verify the login "With SQL Server Authentication using a
Login ID and Password entered by the User." At the bottom of the screen,
enter sa for the user and type in your sa password. Click Next.
6) Check '[] Change the Default Database to:' then select the database that
your m2mdata resides on, in my case m2mdata01. Click Next.
7) Click Finish.
8) Click the button that says "Test Data Source". It should give a small
screen that Should say "Test completed Successfully!" Click OK, OK, and OK.
NOW you can access the database via VFP's command window or from within a
program:
-> sqlconnect('m2mdata01')
(type in your password)
Or, from within a program you can connect to the database using the syntax:
sqlconnect('database','user','password') )
I hope that helps!
Ray
Ray
BTW, this is where VFPs use of different quotes come in handy: because you
can still pass things to VFP via the docmd() like:
docmd("select * from inmast where fpartno = [" + vbcharstring + "] into
cursor tempcursor")
VB ONLY uses double Quotes to encapsulate a character string, whereas VFP
can use doubles, singles, or even square brackets.
Now if ya wanna show a browse screen that gives the user a chance to
double-click on something, that I'm not certain of just yet, but I know it
Is doable...
http://www.adtmag.com/article.aspx?id=20382
Yes, VFP is indeed being killed off by Microsoft, in favor of its own
home-grown Access database development environment.
Knowing that the end of the VFP environment is near, I'm more curious about
what will happen to all of the M2MVFP aND SQL users whom have spent
thousands of hours and dollars in customizations for their current M2M
product, especially after 2012 (which is only 5 years away): Will we all
have to upgrade our M2M products Again as if for the first time? What will
the new backend engine be if it won't be VFP?
I'm definitely curious to see what my colleagues here have thought or what
other information you may have picked up concerning this issue.
- Ray
"The company will continue to provide mainstream support for VFP9 until January 12, 2010 and extended support until January 13, 2015, according to Microsoft's support lifecycle page."
It's been known for some time that VFP 9 will be the last FoxPro.
Visual Basic is Microsoft's preferred application development platform, which is a shame due to it being vastly inferior to FoxPro for developing data centric applications.
FoxPro will continue for another 8 to 10 years, which is a long time in this business. But this shouldn't mean much to most Made2Manage users. Most either are on or will be on SQL in the near term. Using ADO this means you can access your data in any way you please - C#, Visual Basic or continue in VFP. At this moment, VFP remains the most comprehensive language when dealing with data and with a true OOP model (VB is procedural with an OOP façade) one of the best for building comprehensive frameworks for reusability of code.
Brent A. Marcus
Director of Information Technologies
Reinhold Industries, Inc.
bma...@reinhold-ind.com
(949) 232-4216 (Cell)