CALLING ORACLE STORED PROCEDURES I'll quote an earlier Profox message from Andy Davies about calling Oracle stored procedures. I'll add that there seems to be various opinions among users about the Oracle ODBC driver versus the Microsoft Oracle driver. -Anders If anyone else has been struggling with this, here it is: ***************** *** This creates an Oracle SP that returns a cursor: *!* CREATE OR REPLACE PACKAGE my_pkg AS *!* TYPE curTyp IS REF CURSOR RETURN myvu%ROWTYPE; *!* PROCEDURE open_my_cur (my_cur IN OUT curTyp, *!* choice IN VARCHAR2); *!* END htr_pkg; *!* / *!* CREATE OR REPLACE PACKAGE BODY my_pkg AS *!* PROCEDURE open_my_cur (my_cur IN OUT curTyp, *!* choice IN VARCHAR2) IS *!* BEGIN *!* OPEN my_cur FOR SELECT * from myvu *!* where the_key = choice ; *!* END open_my_cur; *!* END my_pkg; *!* / local nHndl, nSQLResult, noVal, cJobNo, ae, oMyVuRow nHndl = sqlconnect("OraODBC") if nHndl <= 0 =aerror(ae) disp memo like ae sqldisconnect(0) return endif noVal = '' cJobNo = '00000001' nSQLResult = SQLExec(nHndl, "{call my_pkg.open_my_cur (?noVal, ?cJobNo)}","MyCursor") * This also works: * nSQLResult = SQLExec(nHndl, "{call my_pkg.open_my_cur (?noVal, '00000001')}","MyCursor") * browse scatter NAME oMyVuRow use in MyCursor * ... **** N.B. The "OraODBC" DSN must use [a recent version of] the Oracle ODBC driver - the Microsoft driver gives: **** Error 1562 "Microsoft ODBC Driver for Oracle cannot bind PL/SQL records or Cursor References" ------------------------------------------------------------------------ CREATING DESKTOP SHORTCUTS WITH CODE Here's how to create desktop shortcuts using code. Windows Scripting Host (WSH) has a method for it: WshShell = CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") oShellLink = WshShell.CreateShortcut(strDesktop + "\Notepad Editor.lnk") oShellLink.TargetPath = "C:\WINNT\NOTEPAD.EXE" oShellLink.WindowStyle = 1 oShellLink.Hotkey = "CTRL+SHIFT+F" oShellLink.IconLocation = "notepad.exe, 0" oShellLink.Description = "NotePad" oShellLink.WorkingDirectory = strDesktop oShellLink.Save -Anders ------------------------------------------------------------------------ FONTS FOR @SAY'S I have a old dos program that will be printing @SAY's to the printer. I need to make sure the printer font is a FIXED font. Where can I set this in the program to make sure it prints that way? In VFP, quickest way is SET PRINTER FONT "Courier New", 12 The default in VFP is Arial. The ", 12" is optional, and is the point size. -Dan Covill ----------------------------------------------------------------------- SQL Statements and indexes When writing a SQL-Select statement which involves multiple indexes, should you list the where clause expressions from most to least restrictive or from least to most restrictive? It kinda doesn't matter... in VFP, the optimized expressions are evaluated first, regardless of their order in the WHERE clause. Once all of your optimizable expressions are evaluated, a result set is generated and then your non-optimizable expressions get tested against each record of that result. So it more depends upon what you've indexed in your table(s). -Chuck Urwiler ---------------------------------------------------------------------- FPT FILES CORRUPTED BY WINDOWS 2000 It has been reported on the ProFox forum that there are several cases where .FPT files have been corrupted under Windows 2000. The problem is caused by write caching, which in Windows 2000 is on by default. Here'w what you can do. [according to the posting] "It is confirmed from Microsoft that Win2K in its default drive cache setting corrupts memo files. The issue has been referred to the VFP team for resolution. In the meantime, disable write cacheing. To do this, right click on any local drive (mapped drives do not have write cacheing) in Explorer, select Properties, and select the Hardware tab. On that page, you will have a list of all local drives. Select in order the ones that matter, and click on the Properties button. That brings up the Properties dialog. Click on the Disk Properties tab. Uncheck the Write Cache Enabled checkbox." ---------------------------------------------------------------------- GUI MENUS FOR VFP: by Dan Covill menuGadgets is a completely data-driven Outlook style menu bar application designed especially for Visual FoxPro developers. menuGadgets features: True Outlook style menu bar complete with space-saving scrollable menu groups provides your users with a fast and organized means of accessing the functions of your applications they use the most. Easy to integrate into your applications - a single command line is all that is required. 100% data-driven - integrated setup screen lets you define: * Menu groups * Menu buttons, captions, icons, and tool-tips * Multi-line button and group commands or procedures * Background and foreground colors by group Integrated configuration screen lets you select the available buttons and groups to be shown on the menu bar as well as global settings. Multi-User ready - will accept up to 15 character User ID to allow individual configurations by user. Automatically resizes when the screen is resized. Can automatically minimize when the mouse is not positioned over the menu bar. Available right-click shortcut menu for setting options during run-time. Using menuGadgets is extremely easy. Simply call the application with one of three parameters - MENU, SETUP, or CONFIG. The MENU option places the defined menu on the screen and activates it, SETUP launches the set up screen (shown below), and CONFIG launches the user configuration screen (also shown below). Changes to the menu made in either screen will be reflected in the menu immediately. Pricing: menuGadgets Application $49.95 menuGadgets with full source $89.95 (A demo is available for free download.) Complete description with screen shots at: ---------------------------------------------------------------------- A PRINT UTILITY As many have found, it's fairly easy to send "Print to File", creating a file with a .PRN suffix. The problem is that when you send that file to the printer ("copy xxx.prn to prn") it almost never looks like what you wanted. Gallicrow Software offers "Imprint," a shareware Windows app that lets you print binary and Postscript files, with control over fonts, Landscape mode, paper size, and more. You can try Imprint free, it's $30 if you decide to keep it. http://www.gallicrow.co.uk/ For help with Windows spooling problems, try "the Ultimate Windows 95 Spool32 FAQ on the Internet" at http://www.starkreality.com/~callen/spool32.htm [I found these in the LangaList newsletter. , highly recommended. DC] ---------------------------------------------------------------------- TRANSFORM DOES MORE by Dan Covill I've been using transform() for a long time as a clean way to format output. Instead of kludges like iif(THISVAR = 0, space(8), str(THISVAR,8,2)) I just say transform(THISVAR, '@Z 9,999.99') which is easier and also puts a comma in, which the users like. But there's another great use for transform(). Used without the picture, it's an easy way to convert stuff to strings without even knowing what type it is. Ever do something like this? wait window "DoAll = "+iif(DOALL, '.T.', '.F.') Well, this works just as well: wait window "DoAll = "+transform(DoAll) Ok, not dramatic. But how about this? wait window FLDNAME + '=' + transform(eval(FLDNAME)) It doesn't care what the type of FLDNAME is, it just converts it to a string. It works for String, Numeric, Logical, Date, and even Memos (but not General fields). This is a great way to do progress output without getting into the VARTYPE() rat's nest. ---------------------------------------------------------------------- WHERE CAN I FIND...? A (semi) permanent list of places to look for technical help when you get blind-sided by the latest urgent requirement. We don't give specific URLs for MSDN articles because (a) they're too long and (b) they change too often! ------------------------------- MSDN ON LINE: There's a ton of stuff here, look at the Magazines tab, and read some of the regular columns. MSDN Library Look in Technical Articles | Visual Studio | Visual FoxPro 3-Tier Apps: MSDN Library: "Building Three-Tier Client/Server Applications with Visual FoxPro" ADO MSDN Library: ADO Jumpstart for Microsoft Visual FoxPro Developers John V. Petersen, April 1999 DNA (Distributed interNet Architecture): MSDN On-line: "Top Windows DNA Performance Mistakes and How to Prevent Them" MTS: Microsoft Transaction Server MSDN Library: "Microsoft Transaction Server for Visual FoxPro Developers" ODBC: MSDN Library: "Using Visual FoxPro to Access Remote Data" VS Installer: MSDN Library: a. "Using Visual Studio Installer for VFP 6.0 Applications" b. "VFP 6.0 and VS Installer Tutorial" Windows General XML - What's New in XML for Microsoft Windows 2000