FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour SQL ADO error writing to table attribute READ
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
SQL ADO error writing to table attribute READ
Posted: Mon Aug 08, 2011 02:26 PM
To All

For some odd reason, I am seeing a production run-time error trying to write a value to a MS Sql Server table with the table attribute of READ. Again, I do realize READ is a protected field and that has only concerned me when I construct a sql statement and specify the [read] brackets .. however this error just recently showed up in existing code that has been running for several years ??

Oddly, I can not seem to duplicate the run-time error on my test server :-)

Any advice would be appreciated ..

Rick Lipkin


Code (fw): Select all Collapse
Application
===========
   Path and name: C:\Documents and Settings\watsonss\My Documents\Pmo21\Pmo21\pmow32.Exe (32 bits)
   Size:   814,592 bytes
   Time from start: 0 hours 0 mins 37 secs 
   Error occurred at: 08/08/2011, 08:22:35
   Error description: Error ADODB.Recordset/6  DISP_E_UNKNOWNNAME: FIELDS
   Args:
     [   1] = C   READ

Stack Calls
===========
   Called from: source\rtl\win32ole.prg => TOLEAUTO:FIELDS(0)
   Called from: USERVIEW.PRG => _DOIT(322)
   Called from: USERVIEW.PRG => (b)_USERVIEW(189)
   Called from: .\source\classes\BUTTON.PRG => TBUTTON:CLICK(176)
   Called from: .\source\classes\CONTROL.PRG => TBUTTON:HANDLEEVENT(1427)
   Called from: .\source\classes\WINDOW.PRG => _FWH(3347)
   Called from:  => SENDMESSAGE(0)
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:COMMAND(407)
   Called from:  => TWINDOW:HANDLEEVENT(0)
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:HANDLEEVENT(928)
   Called from:  => DIALOGBOX(0)
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(273)
   Called from: USERVIEW.PRG => _USERVIEW(195)
   Called from: MAIN.PRG => _ADDUM(536)
   Called from: MAIN.PRG => (b)MAIN(266)
   Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK(445)
   Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP(631)
   Called from:  => TWINDOW:HANDLEEVENT(0)
   Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT(1469)
   Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT(1295)
   Called from: .\source\classes\WINDOW.PRG => _FWH(3347)
   Called from:  => DIALOGBOXINDIRECT(0)
   Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE(273)
   Called from: MAIN.PRG => MAIN(274)


Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: SQL ADO error writing to table attribute READ
Posted: Mon Aug 08, 2011 04:41 PM

To All

I do not know why this syntax :

oRsUser:Fields("READ"):Value := cREAD

decided to quit working in production but instead of referencing the field by name I referenced it by its number

oRsUser:Fields(3):Value

and it seems to be working on my test box ..

Rick Lipkin

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: SQL ADO error writing to table attribute READ
Posted: Mon Aug 08, 2011 04:45 PM

Could it be that READ is a reserved word for the database engine?

EMG

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: SQL ADO error writing to table attribute READ
Posted: Mon Aug 08, 2011 08:32 PM
oRsUser:Fields(3):Value

This is the right solution for you. I see you use reserved words as field names more often.
Regards



G. N. Rao.

Hyderabad, India
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: SQL ADO error writing to table attribute READ
Posted: Mon Aug 08, 2011 08:39 PM

Rao

This is a legacy app from my old employer and knowing what I know today .. I would NEVER use any reserved words as field names ..

As I just mentioned to Enrico .. the legacy production program is using an older version of the xHarbour compiler and it works just fine .. only under xHarbour 1.21 xxx I am seeing this crazy thing show up.

If I were still at my former employer .. I would certainly go in and modify the field name so there would not be any complications using the literal attribute name.

Thanks
Rick

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: SQL ADO error writing to table attribute READ
Posted: Mon Aug 08, 2011 08:47 PM
Rick Lipkin wrote:As I just mentioned to Enrico ..


Where? I can't see any reply from you to my answer in this thread. :-)

Rick Lipkin wrote:the legacy production program is using an older version of the xHarbour compiler and it works just fine .. only under xHarbour 1.21 xxx I am seeing this crazy thing show up.


Maybe older xHarbour version just ignored the error.

EMG
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: SQL ADO error writing to table attribute READ
Posted: Mon Aug 08, 2011 08:53 PM
Enrico

I am multi-tasking .. phone going crazy here .. I meant to send you this note :



Enrico

From what I can gather .. I am using a newer version of xHarbour than the legacy compiled version in production ..

Since I know longer work for this State Agency .. I have had to send executables back and forth to test. Interestingly .. the legacy production version works fine .. however I am currently using xHarbour 1.21 rev 6476 ( have no idea what compiler version is in production ) and it seems this version of xHarbour has changed the way it addresses attribute names especially for protected attribute names ..

I have always known to use to use Select [read],name,[domain] from Userinfo, but in this case I opened the recordset with Select * from Userinfo so accessing all the attributes should be available.

I should hear back soon from my old Employer soon.

Thanks
Rick Lipkin

Posts: 115
Joined: Sat Mar 07, 2009 09:36 PM
Re: SQL ADO error writing to table attribute READ
Posted: Tue Aug 09, 2011 09:18 AM

Buen Dia amigo, hay dos temas uno en mensage dice desconocido el campo y dos la palabra read es una palabra reservada del motor de bases de datos.

solucion cambia el nombre del campo y tambien fijate si en la tabla el campo esta escrito igual.

                                 desde Escobar argentina bellucci juan carlos.

Continue the discussion