ADOSERVER strange error on Append: nFieldPosition Invalid or Missing

Public support forum for peer to peer support with related to the Visual Objects and Vulcan.NET products
Post Reply
User avatar
jjgregg
Posts: 25
Joined: Thu Jul 19, 2018 6:16 pm

ADOSERVER strange error on Append: nFieldPosition Invalid or Missing

Post by jjgregg »

I´ve been going through some corruption of sorts using VO2ADO, VO 2.8 sp4b, with [hide]MS SQL 2008 tables... very strange, the error occurs doing simple statements like ADOSERVER:APPEND or FIELDGET and the trapped error using a codeblock to trap the event reads:

[20936] iPointer=1, instantiating oServer
[20936] error trap, append failed, error: nFieldPosition invalid or missing
[20936] ERROR IN NOIVARGET USED

The error occurs when the server is instantiated but the error also occurs calling any method for this server, Append, FieldPut...

local oServer as adoserver
local cbErr as codeblock

cbErr := ErrorBlock({|oErr|_Break(oErr)})
BEGIN SEQUENCE
oServer := BillingTransactions{nil, oConn1, nil, nil, nil }

RECOVER USING uError
oLog:WriteLine( "Could not open oServer, Error: "+uError:description )


Server declaration:
CLASS BillingTransactions INHERIT AdoServer
//{{%UC%}} USER CODE STARTS HERE (do NOT remove this line)

METHOD INIT(sSource, uConn, nCursorType, nLockType, nOptions ) CLASS BillingTransactions
LOCAL i,nFields AS DWORD
LOCAL aFieldDesc AS ARRAY
LOCAL nPos AS INT
LOCAL nMaxRecords AS LONG
LOCAL sRecnoColumn AS STRING
LOCAL lLongFldNam AS LOGIC
LOCAL sStatement AS STRING
//
// Elements of SQL statement
// TableName : BillingTransactions
// ColumnList :
// WhereClause :
// OrderByClause :
//

IF IsNil(sSource)
// Build Select statement
sStatement := "Select * from BillingTransactions"
sSource := sStatement
ENDIF
lLongFldNam := TRUE
nMaxRecords := 0x7FFFFFFF
sRecnoColumn := ""

IF IsNil(nCursorType)
nCursorType := adOpenStatic
ENDIF
IF IsNil(nLockType)
nLockType := adLockOptimistic
ENDIF
IF IsNil(uConn)
uConn := AdoGetConnection()
// The connection in the AdoServer Editor was; ClientConnector
ENDIF

SELF:PreInit()

SUPER:INIT(sSource, uConn, nCursorType, nLockType, nOptions, lLongFldNam)

oHyperLabel := HyperLabel{#BillingTransactions, "BillingTransactions, "BillingTransactions, NULL_STRING}

IF oHLStatus = NIL
nFields := ALen(aFieldDesc := SELF:FieldDesc)
FOR i:=1 UPTO nFields
nPos := SELF:FieldPos( aFieldDesc[DBC_NAME] )

SELF:SetDataField( nPos,;
DataField{aFieldDesc[DBC_SYMBOL],aFieldDesc[DBC_FIELDSPEC]} )

NEXT

SELF:GoTop()
ENDIF

SELF:PostInit()
[/hide]
RETURN SELF

This makes VO2ADO unusable at this point, ADOSERVERs failed selectively, some fail, otthers operate normallly, I can't get a handle on what is going on. HELP

Thanks
User avatar
robert
Posts: 4555
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

ADOSERVER strange error on Append: nFieldPosition Invalid or Missing

Post by robert »

John.
To help solve this we need:
- a reproducible example
- the table description (create table statement) + some data for your sql table

We already communicated about this by mail. You told me the problem started after you had to reinstall your software because your machine died.
It must be something in your configurations, but we can only help you find that problem if you provide us with the necessary information.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
lumberjack
Posts: 728
Joined: Fri Sep 25, 2015 3:11 pm
Location: South Africa

ADOSERVER strange error on Append: nFieldPosition Invalid or Missing

Post by lumberjack »

Did a quick search on your message and there is nowhere in your code a nFieldPosition variable. I think you looking at the wrong place for the error. Do you have a nFieldPosition column in your table? It seems from the error message you trying to do just that.

HTH
______________________
Johan Nel
Boshof, South Africa
User avatar
robert
Posts: 4555
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

ADOSERVER strange error on Append: nFieldPosition Invalid or Missing

Post by robert »

Johan, John,

I suspect that the 'painted' definition of the form that this code is from has
one or more field names that do not exist in the table anymore.
Therefore the line

Code: Select all

nPos := SELF:FieldPos( aFieldDesc[DBC_NAME] )
assigns a value of 0 to nPos
causing the next line

Code: Select all

SELF:SetDataField( nPos,DataField{aFieldDesc[DBC_SYMBOL],aFieldDesc[DBC_FIELDSPEC]} )
to fail.

nFieldPosition is the parameter name inside the SetDataField method.

That is exactly why I asked John a sample and the database definition.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
jjgregg
Posts: 25
Joined: Thu Jul 19, 2018 6:16 pm

ADOSERVER strange error on Append: nFieldPosition Invalid or Missing

Post by jjgregg »

Thanks for your reply Robert, the only data field on this table is the TIMESTAMP which is a field that continuously gives me problems because it is automatically updated so it has to be ignored by the application I guess, I am removing the field from the ADOSERVER field listing to see if that helps.

Regards,
John
User avatar
robert
Posts: 4555
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

ADOSERVER strange error on Append: nFieldPosition Invalid or Missing

Post by robert »

John,

The term "datafield" has nothing to do with the Date, DateTime or TImeStamp type.
DataField is a class inside the VO Classes that is used to bind a field in a table to a FieldSpec

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
jjgregg
Posts: 25
Joined: Thu Jul 19, 2018 6:16 pm

ADOSERVER strange error on Append: nFieldPosition Invalid or Missing

Post by jjgregg »

The server name message is generated when one tries to instantiate the adoserver but only occurs on the first server, strange but it prevents the program from executing and I am really in trouble here... need to have this working ASAP. Thanks.
Attachments
JJGreggScreenShot.jpg
JJGreggScreenShot.jpg (45.15 KiB) Viewed 820 times
User avatar
robert
Posts: 4555
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

ADOSERVER strange error on Append: nFieldPosition Invalid or Missing

Post by robert »

John,

I have said this before and this the last time I am saying it: you need to give us more information.

The error message in the BillingTransactions:Init seems to indicate that at the time you created this class there was at least one field name (the field names are stored in the FieldDesc access) that no longer exists in the table at this moment.
As a result the assigment to nPos results in a value of 0, which causes the next line (SELF:SetDataField...) to fail.

Sorry for saying this, but I don't understand why you are so stubborn and refuse to show the data that we need to help you ?
- The SQL table definition
- The complete source code of the BillingTransactions class

Images of error messages are really useless here.
Until you provide us the correct info there is not much that we can do.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply