XBROWSER ODBC / ADO -> read only ?

XBROWSER ODBC / ADO -> read only ?

Postby Jimmy » Mon Jul 17, 2023 11:54 am

hi,

i try c:\fwh\samples\testodbc.prg and c:\fwh\samples\access.prg (BUG ISKINDOF)
i can open "Edit" but all are "read only" :shock:

what do i miss :?:
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: XBROWSER ODBC / ADO -> read only ?

Postby Rick Lipkin » Mon Jul 17, 2023 3:50 pm

User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: XBROWSER ODBC / ADO -> read only ?

Postby nageswaragunupudi » Tue Jul 18, 2023 5:38 am

Using fwh\samples\access.prg, the msaccess database of Read/Write.
We revised access.prg and here it is:
Code: Select all  Expand view
#include "fivewin.ch"

REQUEST DBFCDX

static oCn

//----------------------------------------------------------------------------//

function Main()

   local aTables
   local cDataBase   := "xbrtest.mdb"

   FW_SetUnicode( .t. )
   SetGetColorFocus()
   SET DATE GERMAN
   SET CENTURY ON
   FWNumFormat( "E", .t. )

   if !( Right( cFilePath( ExeName() ), 9 ) .XEQ. "\samples\" )
      ? "
Build this program in fwh\samples\ folder"
      QUIT
   endif

   cDataBase   := cFileSetExt( cDataBase, "
mdb" )
   if !File( cDataBase)
      FW_CreateMDB( cDataBase )
   endif
   oCn   := FW_OpenAdoConnection( cDataBase, .t. )
   if oCn == nil
      ? "
Connection fail"
      QUIT
   endif
   ? "
connected"

   ImportDBF()

   ListTables()

   oCn:Close()

return nil

//----------------------------------------------------------------------------//

static function ImportDBF()

   local aTables  := { "
states", "customer", "wwonders" }
   local cTable, cDbf

   for each cTable in aTables
      cDBF     := cTable + "
.dbf"
      if !FW_AdoTableExists( cTable, oCn ) .or. ;
         MsgNoYes( "
Re-Create table " + cTable + " ?"  )
         TRY
            oCn:Execute( "
DROP TABLE " + cTable )
         CATCH
         END
         FW_AdoImportFromDBF( oCn, cDBF )
      endif
   next

return nil

//----------------------------------------------------------------------------//

static function ListTables()

   local aTables, oRs
   local oDlg, oBar, oBrw, oFont

   DEFINE FONT oFont NAME "
TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 400,400 PIXEL TRUEPIXEL ;
      FONT oFont RESIZABLE TITLE "
Tables"
   DEFINE BUTTONBAR oBar OF oDlg SIZE 100,32 2010
   @ 42,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE FW_AdoTables( oCn ) COLUMNS 1 ;
      HEADERS "
Table" CELL LINES NOBORDER FOOTERS

   WITH OBJECT oBrw
      :nStretchCol   := 1
      :lHScroll      := .f.
      :RecSelShowKeyNo()
      :CreateFromCode()
   END

   DEFINE BUTTON OF oBar PROMPT "
Browse" CENTER ACTION ;
      BrowseTable( oBrw:aCols[ 1 ]:Value )
   DEFINE BUTTON OF oBar PROMPT "
Edit" CENTER ACTION ;
      ( oRs := FW_OpenRecordSet( oCn, oBrw:aCols[ 1 ]:Value ), ;
        XEdit( oRs ), oRs:Close() )

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

return nil

//----------------------------------------------------------------------------//

static function BrowseTable( cTable )

   local oDlg, oBar, oFont, oBrw, oRs

   oRs   := FW_OpenRecordSet( oCn, cTable )

   DEFINE FONT oFont NAME "
TAHOMA" SIZE 0,-14
   DEFINE DIALOG oDlg SIZE 800,400 PIXEL TRUEPIXEL ;
      FONT oFont RESIZABLE TITLE cTable
   DEFINE BUTTONBAR oBar OF oDlg SIZE 100,32 2010

   @ 42,20 XBROWSE oBrw SIZE -20,-20 PIXEL OF oDlg ;
      DATASOURCE oRs AUTOCOLS ;
      FASTEDIT FOOTERS CELL LINES NOBORDER

   WITH OBJECT oBrw
      :nEditTypes    := EDIT_GET
      :SetChecks()
      :AutoFit()
      :RecSelShowKeyNo()
      :CreateFromCode()
   END

   DEFINE BUTTON OF oBar PROMPT "
Add"    CENTER ACTION oBrw:EditSource( .t. )
   DEFINE BUTTON OF oBar PROMPT "
Edit"   CENTER ACTION oBrw:EditSource()
   DEFINE BUTTON OF oBar PROMPT "
Delete" CENTER ACTION oBrw:Delete( .t. )

   ACTIVATE DIALOG oDlg CENTERED
   RELEASE FONT oFont

   oRs:Close()

return nil


Please copy this program to 32-bit fwh\samples folder overwriting the existing access.prg and build with
Code: Select all  Expand view
buildh access

You can write modifications in xbrowse and also xedit()
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10643
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: XBROWSER ODBC / ADO -> read only ?

Postby Jimmy » Tue Jul 18, 2023 8:26 pm

hi,
nageswaragunupudi wrote:Using fwh\samples\access.prg, the msaccess database of Read/Write.
We revised access.prg and here it is:

Please copy this program to 32-bit fwh\samples folder overwriting the existing access.prg and build with

Great, thx
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1732
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 59 guests