*:****************************************************************************** *: *: Procedure File D:\SQL_DEMO\CA.PRG *: *: Documented using Visual FoxPro Formatting wizard version .05 *:****************************************************************************** *: CA oConn = 0 the_cno='0' Connstring = "DATABASE=vfp2pg;SERVER=www.smvfp.com; port=5432;UID=VfP2Pg;pwd=HelloWorld;provider=MSDASQLR;DRIVER=postgreSQL;" oConn = Sqlstringconnect(Connstring) If oConn < 1 =Aerror(the_oCA) cMessageTitle = "Error - Connection Error" cMessageText = "The following error occurred:"+Chr(13)+Chr(13)+; "Error Number: "+Str(the_oCA(1))+Chr(13)+; "Error Message: "+the_oCA(2) nDialogType = 0 + 16 + 0 * 0 = Ok * 16 = Stop * 0 = Default to OK nAnswer = Messagebox(cMessageText, nDialogType, cMessageTitle) Else Define Popup leechoice Font 'arial',12 Style 'N' From 10,40 Margin shortcut Title [SELECT INDEX] Define Bar 1 Of leechoice Prompt " \<1. Select all records" Define Bar 2 Of leechoice Prompt " \<2. Parameterized Cursor" On Selection Popup leechoice Deactivate Popup leechoice Activate Popup leechoice Release Popup leechoice the_prompt=Substr(Prompt(),1,2) Do Case Case the_prompt=' 1' the_select = "select arcurrah.CNO, arcurrah.TYPE, arcurrah.BILLCAT, arcurrah.DESCRIPT, "+; "arcurrah.INVOICE, arcurrah.TRANDATE, arcurrah.AMOUNT, arcurrah.THEUNIQUE, "+; "arcurrah.THETIME from arcurrah where arcurrah.cno > -1 order by arcurrah.theunique" wait window 'please be patient while I fetch around 16,500 rows.' nowait noclear got_all=.T. Case the_prompt=' 2' the_select = "select arcurrah.CNO, arcurrah.TYPE, arcurrah.BILLCAT, arcurrah.DESCRIPT, "+; "arcurrah.INVOICE, arcurrah.TRANDATE, arcurrah.AMOUNT, arcurrah.THEUNIQUE, "+; "arcurrah.THETIME from arcurrah where arcurrah.cno = ?the_cno order by arcurrah.theunique" got_all = .F. Otherwise the_select = "select arcurrah.CNO, arcurrah.TYPE, arcurrah.BILLCAT, arcurrah.DESCRIPT, "+; "arcurrah.INVOICE, arcurrah.TRANDATE, arcurrah.AMOUNT, arcurrah.THEUNIQUE, "+; "arcurrah.THETIME from arcurrah where arcurrah.cno = ?the_cno order by arcurrah.theunique" got_all = .F. Endcase the_Cursor_Schema = "CNO N(10, 0), TYPE C(2), BILLCAT N(10, 0), DESCRIPT C(20), INVOICE N(10, 0), TRANDATE D, AMOUNT B(2), THEUNIQUE I, THETIME T" the_UpdatableFieldList = "CNO, TYPE, BILLCAT, DESCRIPT, INVOICE, TRANDATE, AMOUNT" the_UpdateNameList = "CNO arcurrah.CNO, TYPE arcurrah.TYPE, BILLCAT arcurrah.BILLCAT, DESCRIPT arcurrah.DESCRIPT, INVOICE arcurrah.INVOICE, TRANDATE arcurrah.TRANDATE, AMOUNT arcurrah.AMOUNT, THEUNIQUE arcurrah.THEUNIQUE" oCA = Createobject('CursorAdapter') With oCA .Name = 'oCA' .Alias = 'arcur' .AllowUpdate = .T. .AllowDelete = .T. .AllowInsert = .T. .DataSourceType = 'ODBC' .Datasource = oConn .SelectCmd = the_select .Tables = 'arcurrah' .CursorSchema = the_Cursor_Schema .KeyFieldList = "THEUNIQUE" .UpdatableFieldList = the_UpdatableFieldList .UpdateNameList = the_UpdateNameList .AllowUpdate = .T. .SendUpdates = .T. .UpdateType = 1 && update .UseDeDataSource = .T. .WhereType = 1 && key field only .BufferModeOverride = 5 prep = .CursorFill() If !prep =Aerror(the_oCA) cMessageTitle = "Error - CursorFill Method" cMessageText = "The following error occurred:"+Chr(13)+Chr(13)+; "Error Number: "+Str(the_oCA(1))+Chr(13)+; "Error Message: "+the_oCA(2) nDialogType = 0 + 16 + 0 * 0 = Ok * 16 = Stop * 0 = Default to OK nAnswer = Messagebox(cMessageText, nDialogType, cMessageTitle) Endif Endwith wait clear Do Form lee SQLDISCONNECT(oCA.Datasource) Endif ReturnIt would be nice if the VFP team could supply a native driver to each of the