Page 1 of 1

Xbrowse and Mdb

Posted: Sat Feb 09, 2008 9:30 am
by Silvio
I try to open Mdb table with Xbrowse but it not run :

first I open the table

Code: Select all

  oRs = CREATEOBJECT( "ADODB.Recordset" )
    TRY
        oRS:Open( "SELECT * FROM Utenti", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=ecom.mdb", 1, 3 )
    CATCH oErr
        ? oErr:Description
        RETURN NIL
    END TRY
Then I create a Xbrowse table

Code: Select all


  oApp():oGrid := TXBrowse():New( oApp():oDlg )
   oApp():oGrid:nTop    := 00
   oApp():oGrid:nLeft   := nSplit+2
   oApp():oGrid:nBottom :=  ::nGridBottom
   oApp():oGrid:nRight  :=  ::nGridRight


 aBrowse   := { { { || STR( oRs:Fields( "ID" ):Value) }, i18n("Codice"), 150, 0 },;
                  { { || oRs:Fields( "Nome" ):Value }, i18n("Nome"), 150, 0 },;
                  { { || oRs:Fields( "Cognome" ):Value}, i18n("Cognome"), 150, 0 },;
                  { { || oRs:Fields( "Via" ):Value} , i18n("Indirizzo"), 150, 0 } }


   FOR i := 1 TO Len(aBrowse)
      oCol := oApp():oGrid:AddCol()
      oCol:bStrData := aBrowse[ i, 1 ]
      oCol:cHeader  := aBrowse[ i, 2 ]
      oCol:nWidth   := aBrowse[ i, 3 ]
      oCol:nDataStrAlign := aBrowse[ i, 4 ]
      oCol:nHeadStrAlign := aBrowse[ i, 4 ]
   NEXT

   oApp():oGrid:SetRDD()
   oApp():oGrid:CreateFromCode()


it make error on this line

Code: Select all

oApp():oGrid:SetRDD()
why ?

Posted: Sat Feb 09, 2008 9:56 am
by nageswaragunupudi

Code: Select all


// oApp():oGrid:SetRDD()  

oApp():oGrid:SetADO( oRs )

Posted: Sat Feb 09, 2008 10:00 am
by Silvio
Now make another error

Code: Select all

Application
===========
   Path and name: C:\work\prg\Mwopen_W\source\FSDI2006.Exe (32 bits)
   Size: 1,705,984 bytes
   Time from start: 0 hours 0 mins 4 secs 
   Error occurred at: 11-02-2008, 11:03:18
   Error description: Error BASE/1003  Variable does not exist: ORS

Stack Calls
===========
   Called from: pcustomer.prg => (b)CUSTOMER(64)
   Called from: XBROWSE.PRG => TXBRWCOLUMN:PAINTDATA(0)
   Called from: XBROWSE.PRG => TXBROWSE:PAINT(0)
   Called from: XBROWSE.PRG => TXBROWSE:DISPLAY(0)
   Called from: CONTROL.PRG => TXBROWSE:HANDLEEVENT(0)
   Called from: WINDOW.PRG => _FWH(0)
   Called from:  => WINRUN(0)
   Called from: WINDOW.PRG => TWINDOW:ACTIVATE(0)
   Called from: main.prg => TAPPLICATION:ACTIVATE(148)
   Called from: main.prg => MAIN(36)

Posted: Sat Feb 09, 2008 10:05 am
by Silvio
Sorry Now run I made a mistake ...