FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour To Santa: xBrowse AutoSort and ADO Field names with spaces
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
To Santa: xBrowse AutoSort and ADO Field names with spaces
Posted: Fri Dec 14, 2012 10:58 PM
Dear Santa

I would like to ask a big favor and see if there can be a fix to xBrowse when using ADO and field names that have spaces.

The problem comes in when you have a field name such as "User Name" defined as a column. When you chose to autosort the column you get a 'naughty' error.

I do have a work around by adding the column manually and creating a new column name but this is a nagging problem that could probably be fixed by inserting "[User Name]" in the xBrowse code for fields that use ADO.

Here is my code and the error..

Thanks
Rick Lipkin
Code (fw): Select all Collapse
 REDEFINE xBROWSE oLBX             ;
       RECORDSET oRsEmp                  ;
       COLUMNS "EMPLOYEE NUMBER",        ;
               "USER NAME",              ;
               "FIRST NAME",             ;
               "LAST NAME",              ;
               "ADDRESS1",               ;
               "CITY",                   ;
               "STATE",                  ;
               "ZIP CODE",               ;
               "HOME PHONE",             ;
               "OTHER PHONE"             ;
       COLSIZES 50,80,80,80,80,80,30,50,50,50  ;
       HEADERS "EmpNum",                 ;
               "UserId",                 ;
               "First Name",             ;
               "Last Name",              ;
               "Address",                ;
               "City",                   ;
               "St",                     ;
               "Zip",                    ;
               "Home Ph",                ;
               "Other Ph"                ;
       ID 111 of oDlg                    ;
       AUTOSORT AUTOCOLS LINES CELL

Code (fw): Select all Collapse
Application
===========
   Path and name: C:\Fox\Sa\Saw32.Exe (32 bits)
   Size: 4,201,984 bytes
   Compiler version: xHarbour build 1.2.1 Intl. (SimpLex) (Rev. 9444)
   FiveWin  Version: FWHX 12.03
   Windows version: 5.1, Build 2600 Service Pack 3

   Time from start: 0 hours 0 mins 52 secs 
   Error occurred at: 12/14/2012, 17:43:06
   Error description: Error ADODB.Recordset/6  DISP_E_UNKNOWNNAME: _SORT
   Args:
     [   1] = C   USER NAME

Stack Calls
===========
   Called from:  => TOLEAUTO:_SORT( 0 )
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:SETORDER( 11249 )
   Called from: .\source\classes\XBROWSE.PRG => TXBRWCOLUMN:HEADERLBUTTONUP( 10184 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:LBUTTONUP( 3303 )
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1690 )
   Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:HANDLEEVENT( 11630 )
   Called from: .\source\classes\WINDOW.PRG => _FWH( 3159 )
   Called from:  => WINRUN( 0 )
   Called from: .\source\classes\WINDOW.PRG => TMDIFRAME:ACTIVATE( 980 )
   Called from: Main.prg => MAIN( 239 )


Posts: 883
Joined: Tue Oct 11, 2005 11:57 AM
Re: To Santa: xBrowse AutoSort and ADO Field names with spaces
Posted: Sat Dec 15, 2012 01:37 AM

Just an Idea...

cSelect:="select employee number as empnum from employees"

Fullfill with all fields names renaming them to avoid spaces

;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 2 * 1 TB NVME M.2, GTX 1650
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: To Santa: xBrowse AutoSort and ADO Field names with spaces
Posted: Sat Dec 15, 2012 01:55 PM

Adolfo

YES, you are correct .. giving the field an 'alias' should work .. would be nice to just be able to use the native field names especially for tables with lots of fields.

I inherited this ( complicated and sprawling ) Access database ( been a humbling experience ) and I NEVER would have used spaces to define field names. :|

Rick Lipkin

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: To Santa: xBrowse AutoSort and ADO Field names with spaces
Posted: Sun Jan 06, 2013 02:30 PM

Mr Rick

Have you tried specifying column names like "[FIRST NAME]", etc. ?

Regards



G. N. Rao.

Hyderabad, India
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: To Santa: xBrowse AutoSort and ADO Field names with spaces
Posted: Sun Jan 06, 2013 06:03 PM

Rao

Yes, the column does not show the data. The data is the column [first name]

Rick

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: To Santa: xBrowse AutoSort and ADO Field names with spaces
Posted: Mon Jan 07, 2013 02:06 AM
Mr Rick

Please make this modification in XBrowse.prg.

Find these lines at the end of METHOD SetColFromADO
Code (fw): Select all Collapse
   if lAutoOrder
      oCol:cSortOrder   := oCol:cHeader
   endif

Modify this as :
Code (fw): Select all Collapse
   if lAutoOrder
      oCol:cSortOrder   := '[' + oField:Name + ']'
   endif
Regards



G. N. Rao.

Hyderabad, India
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: To Santa: xBrowse AutoSort and ADO Field names with spaces
Posted: Mon Jan 07, 2013 01:41 PM

Rao

YES, Thank you .. that worked .. would you be so kind as to include that fix in the next build of FWH ?

Many Thanks
Rick

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: To Santa: xBrowse AutoSort and ADO Field names with spaces
Posted: Mon Jan 07, 2013 01:42 PM

Included.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion