To All
I am using ADO to connect to MS SQL tables and have been using the standard FW listbox .. Twbrowse and have had no problems ..
I have one routine that needs to be able to 'freeze' the left column at column 5 and also need to be able to move the horozontal cursor to a specific column... say 10
I have been using Hernan's Twbrowse in my ADS version and it works quite will .. however, it has problems with ADO recordsets plus I have to link in ace32.dll .. which is not desirable for this applications.
I need to be able to do something like this .. oBrow:nFreeze := 5
and ON INIT oBrow:gotocol(10)
Does TxBrowse support non-aliased recordsets ?? and if so .. is it possible to freeze columns as well as move the cursor to a specific column ??
Many Thanks
Rick Lipkin
SC Dept of Health, USA
Listbox Freeze column and goto a column ( ADO )
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
Rick:
Excuse me:
My adreess
soisa2002 dot @ prodigy dot net dot mx
Kind regards
[/code]
Excuse me:
Would you send to me a small sample using ADO & FW listbox ?I am using ADO to connect to MS SQL tables and have been using the standard FW listbox .. Twbrowse and have had no problems ..
My adreess
soisa2002 dot @ prodigy dot net dot mx
Kind regards
[/code]
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
- Rick Lipkin
- Posts: 2397
- Joined: Fri Oct 07, 2005 1:50 pm
- Location: Columbia, South Carolina USA
Armondo
Here is a simple listbox look up program I use ..
xPROVIDER := "SQLOLEDB"
xSOURCE := "YOURSERVER"
xCATALOG := "DATABASENAME"
xUSERID := "SQLUSER"
xPASSWORD := "PASSWORD"
//-- grpslct.prg
//
//
STATIC oDLG,oLBX
#INCLUDE "FIVEWIN.CH"
//----------------------
Func GRPGET( cNAME, cMODE, oOBJ, oRs, cTABLE )
LOCAL oBTN1, oBTN2, oRs2,oErr, cSQL, cTITLE
IF cNAME = "ALL"
RETURN(.T.)
ENDIF
IF EMPTY( oOBJ )
oOBJ = " "
ENDIF
IF EMPTY( cTABLE )
cTABLE := "BOGUS"
ENDIF
IF cMODE = "E"
DO CASE
CASE cTABLE = "EMPLOYEE"
IF SUBSTR(cNAME,1,2 ) = SUBSTR(oRs:Fields("GROUP1"):Value,1,2) .and.;
oRs:Fields("GROUP1"):Value <> SPACE(2)
RETURN(.T.)
ENDIF
ENDCASE
ENDIF
IF EMPTY( cNAME )
cNAME := "BOGUS"
ENDIF
cNAME := UPPER(ALLTRIM(cNAME))
oRs2 := TOleAuto():New( "ADODB.Recordset" )
oRs2:CursorType := 1 // opendkeyset
oRs2:CursorLocation := 3 // local cache
oRs2:LockType := 3 // lockoportunistic
IF xADMIN = 'Y'
cSQL := "SELECT * FROM GROUPS order by progid,code"
cTITLE := "GROUP Select for ALL"
ELSE
cSQL := "SELECT * from GROUPS where progid = '"+xPROGID+"' order by code"
cTITLE := "GROUP Select for Progid "+xPROGID
ENDIF
TRY
oRS2:Open( cSQL,'Provider='+xPROVIDER+';Data Source='+xSOURCE+';Initial Catalog='+xCATALOG+';User Id='+xUSERID+';Password='+xPASSWORD )
CATCH oErr
MsgInfo( "Error in Opening GROUPS table" )
RETURN(.F.)
END TRY
IF EMPTY( cNAME ) .or. cNAME = " "
cNAME := "BOGUS"
ENDIF
cNAME := UPPER(ALLTRIM(cNAME))
oRs2:Find( "code like '"+cNAME+"%'" )
IF oRs2:eof
oRs2:MoveFirst()
ENDIF
DEFINE DIALOG oDlg RESOURCE "GRPSLCT" ;
COLOR "N/W" ;
TITLE cTITLE
REDEFINE LISTBOX oLBX FIELDS ;
oRs2:Fields("CODE"):Value, ;
oRs2:Fields("DESC"):Value, ;
oRs2:Fields("PROGID"):Value ;
HEADERS "Code", ;
"Desc", ;
"ProgID" ;
SIZES 50,170, 50 ;
ID 111 of oDlg
oLbx:bLogicLen := { || oRs2:RecordCount }
oLbx:bGoTop := { || oRs2:MoveFirst() }
oLbx:bGoBottom := { || oRs2:MoveLast() }
oLbx:bSkip := { | nSkip | Skipper( oRs2, nSkip ) }
oLbx:cAlias := "ARRAY"
REDEFINE BUTTON oBTN1 ID 112 of oDLG ;
ACTION ( zGROUP1 := oRs2:Fields("CODE"):Value, ;
oOBJ:Refresh(), ;
oDlg:END()) ;
DEFAULT
REDEFINE BUTTON oBTN2 ID 118 of oDLG ;
ACTION ( oDlg:End() )
ACTIVATE DIALOG oDlg
oDLG := NIL
oLBX := NIL
oRs2:Close()
SysReFresh()
RETURN( .T. )
//-------------------------------
STATIC FUNCTION SKIPPER( oRsx, nSkip )
LOCAL nRec := oRsx:AbsolutePosition
oRsx:Move( nSkip )
IF oRsx:EOF; oRsx:MoveLast(); ENDIF
IF oRsx:BOF; oRsx:MoveFirst(); ENDIF
RETURN( oRsx:AbsolutePosition - nRec )
// end grpslct.prg
Here is a simple listbox look up program I use ..
xPROVIDER := "SQLOLEDB"
xSOURCE := "YOURSERVER"
xCATALOG := "DATABASENAME"
xUSERID := "SQLUSER"
xPASSWORD := "PASSWORD"
//-- grpslct.prg
//
//
STATIC oDLG,oLBX
#INCLUDE "FIVEWIN.CH"
//----------------------
Func GRPGET( cNAME, cMODE, oOBJ, oRs, cTABLE )
LOCAL oBTN1, oBTN2, oRs2,oErr, cSQL, cTITLE
IF cNAME = "ALL"
RETURN(.T.)
ENDIF
IF EMPTY( oOBJ )
oOBJ = " "
ENDIF
IF EMPTY( cTABLE )
cTABLE := "BOGUS"
ENDIF
IF cMODE = "E"
DO CASE
CASE cTABLE = "EMPLOYEE"
IF SUBSTR(cNAME,1,2 ) = SUBSTR(oRs:Fields("GROUP1"):Value,1,2) .and.;
oRs:Fields("GROUP1"):Value <> SPACE(2)
RETURN(.T.)
ENDIF
ENDCASE
ENDIF
IF EMPTY( cNAME )
cNAME := "BOGUS"
ENDIF
cNAME := UPPER(ALLTRIM(cNAME))
oRs2 := TOleAuto():New( "ADODB.Recordset" )
oRs2:CursorType := 1 // opendkeyset
oRs2:CursorLocation := 3 // local cache
oRs2:LockType := 3 // lockoportunistic
IF xADMIN = 'Y'
cSQL := "SELECT * FROM GROUPS order by progid,code"
cTITLE := "GROUP Select for ALL"
ELSE
cSQL := "SELECT * from GROUPS where progid = '"+xPROGID+"' order by code"
cTITLE := "GROUP Select for Progid "+xPROGID
ENDIF
TRY
oRS2:Open( cSQL,'Provider='+xPROVIDER+';Data Source='+xSOURCE+';Initial Catalog='+xCATALOG+';User Id='+xUSERID+';Password='+xPASSWORD )
CATCH oErr
MsgInfo( "Error in Opening GROUPS table" )
RETURN(.F.)
END TRY
IF EMPTY( cNAME ) .or. cNAME = " "
cNAME := "BOGUS"
ENDIF
cNAME := UPPER(ALLTRIM(cNAME))
oRs2:Find( "code like '"+cNAME+"%'" )
IF oRs2:eof
oRs2:MoveFirst()
ENDIF
DEFINE DIALOG oDlg RESOURCE "GRPSLCT" ;
COLOR "N/W" ;
TITLE cTITLE
REDEFINE LISTBOX oLBX FIELDS ;
oRs2:Fields("CODE"):Value, ;
oRs2:Fields("DESC"):Value, ;
oRs2:Fields("PROGID"):Value ;
HEADERS "Code", ;
"Desc", ;
"ProgID" ;
SIZES 50,170, 50 ;
ID 111 of oDlg
oLbx:bLogicLen := { || oRs2:RecordCount }
oLbx:bGoTop := { || oRs2:MoveFirst() }
oLbx:bGoBottom := { || oRs2:MoveLast() }
oLbx:bSkip := { | nSkip | Skipper( oRs2, nSkip ) }
oLbx:cAlias := "ARRAY"
REDEFINE BUTTON oBTN1 ID 112 of oDLG ;
ACTION ( zGROUP1 := oRs2:Fields("CODE"):Value, ;
oOBJ:Refresh(), ;
oDlg:END()) ;
DEFAULT
REDEFINE BUTTON oBTN2 ID 118 of oDLG ;
ACTION ( oDlg:End() )
ACTIVATE DIALOG oDlg
oDLG := NIL
oLBX := NIL
oRs2:Close()
SysReFresh()
RETURN( .T. )
//-------------------------------
STATIC FUNCTION SKIPPER( oRsx, nSkip )
LOCAL nRec := oRsx:AbsolutePosition
oRsx:Move( nSkip )
IF oRsx:EOF; oRsx:MoveLast(); ENDIF
IF oRsx:BOF; oRsx:MoveFirst(); ENDIF
RETURN( oRsx:AbsolutePosition - nRec )
// end grpslct.prg
- James Bott
- Posts: 4654
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Rick,
>I need to be able to do something like this .. oBrow:nFreeze := 5
and ON INIT oBrow:gotocol(10)
TWbrowse has a goRight() method but no nFreeze var.
You can do this with TSBrowse.
oBrow:nFreeze:=5
for i = 1 to nCol
oBrow:goright()
next
You can get TSBrowse on my website.
TXBrowse also has nFreeze and goRight().
James
>I need to be able to do something like this .. oBrow:nFreeze := 5
and ON INIT oBrow:gotocol(10)
TWbrowse has a goRight() method but no nFreeze var.
You can do this with TSBrowse.
oBrow:nFreeze:=5
for i = 1 to nCol
oBrow:goright()
next
You can get TSBrowse on my website.
TXBrowse also has nFreeze and goRight().
James
Rick:
Thank you so much.
Best regards
Thank you so much.
Best regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
- Enrico Maria Giordano
- Posts: 7355
- Joined: Thu Oct 06, 2005 8:17 pm
- Location: Roma - Italia
- Contact:
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
It is very simple to do with xBrowse
Code: Select all
@ 0,0 XBROWSE oBrw OF oWnd
oBrw:SetADO( oRecSet )
oBrw:CreateFromCode()
oWnd:oClient := oBrw
oBrw:nFreeze := 3
oBrw:nColSel := 8
ACTIVATE WINDOW oWnd ON INIT ( oBrw:SetFocus() )
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
- nageswaragunupudi
- Posts: 8017
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Works in Dialogs too :
Code: Select all
LOCAL oDlg, oRecSet, oBrw
oRecSet := GetRecSet()
DEFINE DIALOG oDlg SIZE 600,400 PIXEL TITLE 'XBRW ADO IN DLG'
@ 10,10 XBROWSE oBrw SIZE 280,165 PIXEL OF oDlg
// pl keep the two lines below till FWH releases their fix
oBrw:nTop := 10
oBrw:nLeft := 10
// the above two lines
oBrw:SetADO( oRecSet )
oBrw:CreateFromCode()
oBrw:nFreeze := 3
oBrw:nColSel := 6
@ 180,250 BUTTON 'Close' SIZE 40,13 PIXEL OF oDlg ACTION oDlg:End()
ACTIVATE DIALOG oDlg CENTERED
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India