SQL ADO error writing to table attribute READ

SQL ADO error writing to table attribute READ

Postby Rick Lipkin » Mon Aug 08, 2011 2: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: Select all  Expand view

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)
 


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

Re: SQL ADO error writing to table attribute READ

Postby Rick Lipkin » Mon Aug 08, 2011 4: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
User avatar
Rick Lipkin
 
Posts: 2636
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: SQL ADO error writing to table attribute READ

Postby Enrico Maria Giordano » Mon Aug 08, 2011 4:45 pm

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

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8381
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: SQL ADO error writing to table attribute READ

Postby nageswaragunupudi » Mon Aug 08, 2011 8: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
User avatar
nageswaragunupudi
 
Posts: 10316
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: SQL ADO error writing to table attribute READ

Postby Rick Lipkin » Mon Aug 08, 2011 8: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
User avatar
Rick Lipkin
 
Posts: 2636
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: SQL ADO error writing to table attribute READ

Postby Enrico Maria Giordano » Mon Aug 08, 2011 8: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
User avatar
Enrico Maria Giordano
 
Posts: 8381
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: SQL ADO error writing to table attribute READ

Postby Rick Lipkin » Mon Aug 08, 2011 8: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

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

Re: SQL ADO error writing to table attribute READ

Postby juan carlos bellucci » Tue Aug 09, 2011 9: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.
juan carlos bellucci
 
Posts: 115
Joined: Sat Mar 07, 2009 9:36 pm
Location: Argentina


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 34 guests