To Santa: xBrowse AutoSort and ADO Field names with spaces

To Santa: xBrowse AutoSort and ADO Field names with spaces

Postby Rick Lipkin » 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: Select all  Expand view

 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: Select all  Expand view

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 )
 


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

Re: To Santa: xBrowse AutoSort and ADO Field names with spaces

Postby Adolfo » Sat Dec 15, 2012 1: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
User avatar
Adolfo
 
Posts: 860
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Re: To Santa: xBrowse AutoSort and ADO Field names with spaces

Postby Rick Lipkin » Sat Dec 15, 2012 1: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
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: To Santa: xBrowse AutoSort and ADO Field names with spaces

Postby nageswaragunupudi » Sun Jan 06, 2013 2:30 pm

Mr Rick

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

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

Re: To Santa: xBrowse AutoSort and ADO Field names with spaces

Postby Rick Lipkin » Sun Jan 06, 2013 6:03 pm

Rao

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

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

Re: To Santa: xBrowse AutoSort and ADO Field names with spaces

Postby nageswaragunupudi » Mon Jan 07, 2013 2:06 am

Mr Rick

Please make this modification in XBrowse.prg.

Find these lines at the end of METHOD SetColFromADO
Code: Select all  Expand view
  if lAutoOrder
      oCol:cSortOrder   := oCol:cHeader
   endif
 

Modify this as :
Code: Select all  Expand view
  if lAutoOrder
      oCol:cSortOrder   := '[' + oField:Name + ']'
   endif
 
Regards

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

Re: To Santa: xBrowse AutoSort and ADO Field names with spaces

Postby Rick Lipkin » Mon Jan 07, 2013 1: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
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: To Santa: xBrowse AutoSort and ADO Field names with spaces

Postby nageswaragunupudi » Mon Jan 07, 2013 1:42 pm

Included.
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 94 guests