Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Andy Kramek
  Where is Andy Kramek?
 Hot Springs Village
 Arkansas - United States
 Andy Kramek
 To: Randy Smith
  Where is Randy Smith?
 Hudson
 Wisconsin - United States
 Randy Smith
 Tags
Subject: RE: Why ODBC and Not OLEDB?
Thread ID: 110533 Message ID: 114564 # Views: 15 # Ratings: 1
Version: Visual FoxPro 9 Category: ODBC, ADO and OLEDB
Date: Wednesday, November 29, 2006 1:15:09 PM         
   


Hi Randy

> I have been out of the Foxpro game for over 5 years. Can you tell me, please, just how in the world one does that ShellExecute call you are talking about to get the .reg entries into the system, and if I have to do it differently between "new" installs of the DSN and "update" installs, as you alluded to that DBA's might need if they move the database?
>
> This solution sounds like EXACTLY what I need!

The first thing you need is some code in your application to check for a newer version of the reg file on the server. Coincidentally Ken Murphy posted an example of this code today, in another thread, so I stole this from him:
As to creating an updater? Not too difficult. The key is the FDATE() function. Check it out in help.
IF FDATE([Path2MyLatestVersion\ODBC.REG],1) > FDATE([Path2MyClientVersion\ODBC.REG],1)
   COPY FILE [Path2MyLatestVersion\ODBC.REG] TO [Path2MyClientVersion\ODBC.REG]
ENDIF 

This should be called from your application start-up to copy a new file to the local machine. You then need to add a call to something to update the driver and then call an "Update Driver" function with the Path/Filename. This function can use the windows API call, ShellExecute, to run the .Reg file like this:

**********************************************************************
* Program......: ExecFile.prg
* Uses WinApi..: ShellExecute
* Function.....: Opens a file in the application that it's associated with.
* Parameters...: tcDocName - Name of the file to open
* Return Values:
* .............: 2 - Bad Association (e.g. invalid file name)
* .............: 31 - No application association
* .............: 29 - Failure to load application
* .............: 30 - Application is busy
* .............: Values over 32 indicate success
* .............: and return an instance handle for
* .............: the application started (e.g. a browser)
**********************************************************************
LPARAMETERS tcDocName
LOCAL lnRetVal, lnShow, lcAction

*** Check Parameters
IF VARTYPE( tcDocName ) # "C" OR EMPTY(tcDocName)
  WAIT WINDOW "Must Pass a valid file name and extension" NOWAIT
  RETURN
ENDIF

*** Must have an Extension too
IF EMPTY( JUSTEXT( tcDocName ))
  WAIT WINDOW "Must Pass a valid file name and extension" NOWAIT
  RETURN
ENDIF

*** Declare API function
DECLARE INTEGER ShellExecute IN Shell32.dll ;
  LONG HWnd, ;
  STRING cAction, ;
  STRING cFileName, ;
  STRING cParameters, ;
  STRING cPath, ;
  INTEGER nShowWindow

*** Now execute it
lnRetVal = ShellExecute( 0, 'Open', tcDocName, "", "", 5) 
RETURN lnRetVal


Regards
Andy Kramek
Microsoft MVP (Visual FoxPro)
Tightline Computers Inc, Akron Ohio, USA

ENTIRE THREAD

Why ODBC and Not OLEDB? Posted by Dexter Carlit @ 10/19/2006 10:00:17 PM
RE: Why ODBC and Not OLEDB? Posted by Pete Sass @ 10/20/2006 2:44:12 PM
RE: Why ODBC and Not OLEDB? Posted by Dexter Carlit @ 10/20/2006 5:22:23 PM
RE: Why ODBC and Not OLEDB? Posted by Pete Sass @ 10/20/2006 7:30:36 PM
RE: Why ODBC and Not OLEDB? Posted by Ken Murphy @ 10/20/2006 7:37:19 PM
RE: Why ODBC and Not OLEDB? Posted by Bernard Bout @ 10/23/2006 10:38:51 AM
RE: Why ODBC and Not OLEDB? Posted by Ryan Lashway @ 12/4/2006 9:02:45 PM
RE: Why ODBC and Not OLEDB? Posted by Andy Kramek @ 10/23/2006 1:57:47 PM
RE: Why ODBC and Not OLEDB? Posted by Eric den Doop @ 10/23/2006 2:43:15 PM
RE: Why ODBC and Not OLEDB? Posted by Andy Kramek @ 10/24/2006 12:17:38 PM
RE: Why ODBC and Not OLEDB? Posted by Nilson Rishi @ 10/23/2006 3:32:12 PM
RE: Why ODBC and Not OLEDB? Posted by Ken Murphy @ 10/23/2006 6:37:52 PM
RE: Why ODBC and Not OLEDB? Posted by Nilson Rishi @ 10/24/2006 5:17:33 AM
RE: Why ODBC and Not OLEDB? Posted by Bernard Bout @ 10/24/2006 6:18:13 AM
RE: Why ODBC and Not OLEDB? Posted by Nilson Rishi @ 10/24/2006 8:31:50 AM
RE: Why ODBC and Not OLEDB? Posted by tushar @ 10/24/2006 7:22:47 AM
RE: Why ODBC and Not OLEDB? Posted by Nilson Rishi @ 10/24/2006 10:00:29 AM
RE: Why ODBC and Not OLEDB? Posted by Andy Kramek @ 10/24/2006 1:32:41 PM
RE: Why ODBC and Not OLEDB? Posted by tushar @ 10/25/2006 9:14:35 AM
RE: Why ODBC and Not OLEDB? Posted by Andy Kramek @ 10/25/2006 1:10:22 PM
RE: Why ODBC and Not OLEDB? Posted by Andy Kramek @ 10/24/2006 12:26:39 PM
RE: Why ODBC and Not OLEDB? Posted by Nilson Rishi @ 10/24/2006 1:03:04 PM
RE: Why ODBC and Not OLEDB? Posted by Andy Kramek @ 10/24/2006 1:21:46 PM
RE: Why ODBC and Not OLEDB? Posted by Pete Sass @ 10/24/2006 10:23:04 PM
RE: Why ODBC and Not OLEDB? Posted by Ken Murphy @ 10/25/2006 1:05:40 AM
RE: Why ODBC and Not OLEDB? Posted by Nilson Rishi @ 10/25/2006 4:31:57 AM
RE: Why ODBC and Not OLEDB? Posted by tushar @ 10/25/2006 9:28:28 AM
RE: Why ODBC and Not OLEDB? Posted by Andy Kramek @ 10/25/2006 3:04:41 PM
RE: Why ODBC and Not OLEDB? Posted by Pete Sass @ 10/25/2006 4:10:42 PM
RE: Why ODBC and Not OLEDB? Posted by Ken Murphy @ 10/25/2006 4:47:32 PM
RE: Why ODBC and Not OLEDB? Posted by Bernard Bout @ 10/25/2006 6:13:41 PM
RE: Why ODBC and Not OLEDB? Posted by Ken Murphy @ 10/25/2006 6:40:19 PM
RE: Why ODBC and Not OLEDB? Posted by Bernard Bout @ 10/26/2006 5:55:08 AM
RE: Why ODBC and Not OLEDB? Posted by Ken Murphy @ 10/26/2006 2:33:34 PM
RE: Why ODBC and Not OLEDB? Posted by Bernard Bout @ 10/26/2006 11:33:28 PM
RE: Why ODBC and Not OLEDB? Posted by Randy Smith @ 11/28/2006 8:59:48 PM
RE: Why ODBC and Not OLEDB? Posted by Andy Kramek @ 11/29/2006 1:15:09 PM
RE: Why ODBC and Not OLEDB? Posted by Randy Smith @ 11/29/2006 2:58:16 PM
RE: Why ODBC and Not OLEDB? Posted by Andy Kramek @ 11/29/2006 7:27:04 PM
RE: Why ODBC and Not OLEDB? Posted by Randy Smith @ 11/30/2006 11:14:13 PM
RE: Why ODBC and Not OLEDB? Posted by Andy Kramek @ 12/1/2006 1:00:35 PM
RE: Why ODBC and Not OLEDB? Posted by Randy Smith @ 12/1/2006 4:03:51 PM
RE: Why ODBC and Not OLEDB? Posted by Andy Kramek @ 12/1/2006 5:21:24 PM
RE: Why ODBC and Not OLEDB? Posted by Randy Smith @ 12/5/2006 1:25:04 AM
RE: Why ODBC and Not OLEDB? Posted by Glenn Villar @ 2/24/2009 4:28:19 AM
RE: Why ODBC and Not OLEDB? Posted by Boudewijn Lutgerink @ 10/27/2006 11:33:27 AM
RE: Why ODBC and Not OLEDB? Posted by Ken Murphy @ 10/27/2006 2:27:33 PM
RE: Why ODBC and Not OLEDB? Posted by Boudewijn Lutgerink @ 12/5/2006 12:55:03 PM
RE: Why ODBC and Not OLEDB? Posted by Ken Murphy @ 12/5/2006 3:12:45 PM