Dear nageswaragunupudi
I made a s you sad but it make erro on Sort command
I try with :
ors:sort:="First"
or
ors:sort:field("first"):value
or
ors:sort:field("first")::name
I must create a small sample to see it ...
#include "FiveWin.ch"
#include "Splitter.ch"
STATIC oDb, oRs
FUNCTION Customer()
LOCAL aBrowse
LOCAL nSplit :=102
LOCAL nOrder :=1
LOCAL nRecno :=1
LOCAL oDlg,oFont,oTab
oRs = CREATEOBJECT( "ADODB.Recordset" )
TRY
oRs:Open( "SELECT * FROM Utenti ORDER BY COGNOME", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=ecom.mdb", 1, 3 )
CATCH oErr
? oErr:Description
RETURN NIL
END TRY
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
DEFINE DIALOG oDlg from 2,4 to 24,80;
TITLE "test xbrowse with tabs with MDB" ;
FONT oFont
oBrw := TXBrowse():New( oDlg )
WITH OBJECT oBrw
:nTop := 10
:nLeft := 20
:nBottom := 150
:nRight := 300
END
aBrowse := { { { || STR( oRs:Fields( "ID" ):Value) }, i18n("Codice"), 50, 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 } ,;
{ { || oRs:Fields( "Civico" ):Value} , i18n("Civico"), 150, 0 },;
{ { || oRs:Fields( "Citta" ):Value} , i18n("Città"), 150, 0 } ,;
{ { || oRs:Fields( "Provincia" ):Value} , i18n("Prov"), 150, 0 }}
FOR i := 1 TO Len(aBrowse)
oCol := oBrw: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
oBrw:SetADO( oRs )
oBrw:CreateFromCode()
oBrw:nRowHeight := 21
oBrw:nHeaderHeight := 36
@ oBrw:nBottom+1,20 TABS oTab ;
OPTION nOrder SIZE oDlg:nWidth()-50, 12 PIXEL OF oDlg ;
ITEMS ' First ', ' Last ' ;
ACTION ( nOrder := oTab:nOption ,;
if( norder=1, oRs:Sort := 'ID' ,oRs:Sort := 'COGNOME' ),;
oRs:MoveFirst() ,;
oBrw:Refresh(.t.) )
ACTIVATE DIALOG oDlg
RETURN NIL
oRs = CREATEOBJECT( "ADODB.Recordset" )
oRs:CursorLocation := 3 // insert this line here
TRY
#include "FiveWin.ch"
#include "Splitter.ch"
STATIC oDb, oRs
FUNCTION Customer()
LOCAL aBrowse
LOCAL nSplit :=102
LOCAL nOrder :=1
LOCAL nRecno :=1
LOCAL oDlg,oFont,oTab
Local aOrders := { "ID", "NOME", "COGNOME", "CITTA" }
oRs = CREATEOBJECT( "ADODB.Recordset" )
oRs:CursorLocation := 3 // insert this line here
TRY
oRs:Open( "SELECT * FROM Utenti ORDER BY COGNOME", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=ecom.mdb", 1, 3 )
CATCH oErr
? oErr:Description
RETURN NIL
END TRY
DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-12
DEFINE DIALOG oDlg from 2,4 to 24,80;
TITLE "test xbrowse with tabs with MDB" ;
FONT oFont
oBrw := TXBrowse():New( oDlg )
WITH OBJECT oBrw
:nTop := 10
:nLeft := 20
:nBottom := 150
:nRight := 300
END
aBrowse := { { { || STR( oRs:Fields( "ID" ):Value) }, i18n("Codice"), 50, 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 } ,;
{ { || oRs:Fields( "Civico" ):Value} , i18n("Civico"), 150, 0 },;
{ { || oRs:Fields( "Citta" ):Value} , i18n("Città"), 150, 0 } ,;
{ { || oRs:Fields( "Provincia" ):Value} , i18n("Prov"), 150, 0 }}
FOR i := 1 TO Len(aBrowse)
oCol := oBrw: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
oBrw:SetADO( oRs )
oBrw:CreateFromCode()
oBrw:nRowHeight := 21
oBrw:nHeaderHeight := 36
@ oBrw:nBottom+1,20 TABS oTab ;
OPTION nOrder SIZE oDlg:nWidth()-50, 12 PIXEL OF oDlg ;
ITEMS ' CODICE ', 'NOME' ,'COGNOME';
ACTION ( nOrder := oTab:nOption ,;
oRs:Sort := aOrders[oTab:nOption],;
oRs:MoveFirst() ,;
oBrw:Refresh(.t.) )
ACTIVATE DIALOG oDlg
RETURN NIL
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Horizon and 40 guests