Prev: Spinners
Next: Exchange
From: Woerdie on
See code below, when running code i get an error on line:
oOutput->(FIELDPUT(n, SELF:oDCBrowseGrid:oDBServer:FIELDGET(n)))

***********************ERROR********************************
Visual Objects (Version 2.8. Build 3.2837), Version 2.8 SP3
29/03/2010 18:44:20
Application: ......

Error message:
----------------------------
Error Code: 38 [ LOCK REQUIRED ]
Subsystem: DBFCDX
Error Subcode: 1122 (Record has to be locked)
CallStack:
....
....
Error Object created:
--------------------
SubSystem :DBFCDX
SubCode :1122
GenCode :Lock required
OsCode :0
ArgType :NIL
FuncPtr :0x00000000
ArgNum :0
FuncSym :
Severity :3
CanDefault :.F.
CanRetry :.F.
CanSubstitute :.F.
Operation :
Description :
FileName :
Tries :1
FileHandle :0
SubCodeText :Record has to be locked



Code:
nCurrentRecno := SELF:oDCBrowseGrid:oDBServer:Recno

SELF:oDCBrowseGrid:oDBServer:SuspendNotification()
SELF:oDCBrowseGrid:GoTop()

oWin:= PrintProgress{oSystem:Shell,
Range{0,oDCBrowseGrid:oDBServer:OrderKeyCount()},int(oDCBrowseGrid:oDBServer:OrderKeyCount()/
10)}
oWin:Show()

DO WHILE !SELF:oDCBrowseGrid:oDBServer:Eof
IF self:oDCBrowseGrid:oDBServer:Betaald == FALSE
IF oOutput->(DBAPPEND())
y := SELF:oDCBrowseGrid:oDBServer:FCount
FOR n := 1 TO y
oOutput->(FIELDPUT(n, SELF:oDCBrowseGrid:oDBServer:FIELDGET(n)))
NEXT n
ENDIF
ENDIF
self:oDCBrowseGrid:oDBServer:Skip(1)

IF oWin:Update()
EXIT
ENDIF

ENDDO

oWin:EndDialog()

SELF:oDCBrowseGrid:GoTo(nCurrentRecno)
SELF:oDCBrowseGrid:oDBServer:ResetNotification()

oOutput->(DBCREATEORDER("FACTUURNR",oSystem:workdir +
"\FACTUREN.CDX","FACTUURNR"))


oOutput->(DBCLOSEAREA())
From: Simon Goodman on
You're mixing DBF and DBServer code.

I guess oOutput is your DBServer?

Try

oOutput:Append()
.....
oOutput:Fieldput(n,SELF:oDCBrowseGrid:oDBServer:FIELDGET(n))

HTH

Simon


> IF oOutput->(DBAPPEND())
> y := SELF:oDCBrowseGrid:oDBServer:FCount
> FOR n := 1 TO y
> oOutput->(FIELDPUT(n, SELF:oDCBrowseGrid:oDBServer:FIELDGET(n)))
> NEXT n


"Woerdie" <woerdekom(a)gmail.com> wrote in message
news:acd69a23-0269-4cbc-9f32-f311d74b3ffb(a)g11g2000yqe.googlegroups.com...
> See code below, when running code i get an error on line:
> oOutput->(FIELDPUT(n, SELF:oDCBrowseGrid:oDBServer:FIELDGET(n)))
>
> ***********************ERROR********************************
> Visual Objects (Version 2.8. Build 3.2837), Version 2.8 SP3
> 29/03/2010 18:44:20
> Application: ......
>
> Error message:
> ----------------------------
> Error Code: 38 [ LOCK REQUIRED ]
> Subsystem: DBFCDX
> Error Subcode: 1122 (Record has to be locked)
> CallStack:
> ...
> ...
> Error Object created:
> --------------------
> SubSystem :DBFCDX
> SubCode :1122
> GenCode :Lock required
> OsCode :0
> ArgType :NIL
> FuncPtr :0x00000000
> ArgNum :0
> FuncSym :
> Severity :3
> CanDefault :.F.
> CanRetry :.F.
> CanSubstitute :.F.
> Operation :
> Description :
> FileName :
> Tries :1
> FileHandle :0
> SubCodeText :Record has to be locked
>
>
>
> Code:
> nCurrentRecno := SELF:oDCBrowseGrid:oDBServer:Recno
>
> SELF:oDCBrowseGrid:oDBServer:SuspendNotification()
> SELF:oDCBrowseGrid:GoTop()
>
> oWin:= PrintProgress{oSystem:Shell,
> Range{0,oDCBrowseGrid:oDBServer:OrderKeyCount()},int(oDCBrowseGrid:oDBServer:OrderKeyCount()/
> 10)}
> oWin:Show()
>
> DO WHILE !SELF:oDCBrowseGrid:oDBServer:Eof
> IF self:oDCBrowseGrid:oDBServer:Betaald == FALSE
> IF oOutput->(DBAPPEND())
> y := SELF:oDCBrowseGrid:oDBServer:FCount
> FOR n := 1 TO y
> oOutput->(FIELDPUT(n, SELF:oDCBrowseGrid:oDBServer:FIELDGET(n)))
> NEXT n
> ENDIF
> ENDIF
> self:oDCBrowseGrid:oDBServer:Skip(1)
>
> IF oWin:Update()
> EXIT
> ENDIF
>
> ENDDO
>
> oWin:EndDialog()
>
> SELF:oDCBrowseGrid:GoTo(nCurrentRecno)
> SELF:oDCBrowseGrid:oDBServer:ResetNotification()
>
> oOutput->(DBCREATEORDER("FACTUURNR",oSystem:workdir +
> "\FACTUREN.CDX","FACTUURNR"))
>
>
> oOutput->(DBCLOSEAREA())


From: Geoff Schaller on
Just as Simon suggested, use only DBServer methods:

oServer:Append() etc.

Geoff



"Woerdie" <woerdekom(a)gmail.com> wrote in message
news:acd69a23-0269-4cbc-9f32-f311d74b3ffb(a)g11g2000yqe.googlegroups.com:

> See code below, when running code i get an error on line:
> oOutput->(FIELDPUT(n, SELF:oDCBrowseGrid:oDBServer:FIELDGET(n)))
>
> ***********************ERROR********************************
> Visual Objects (Version 2.8. Build 3.2837), Version 2.8 SP3
> 29/03/2010 18:44:20
> Application: ......
>
> Error message:
> ----------------------------
> Error Code: 38 [ LOCK REQUIRED ]
> Subsystem: DBFCDX
> Error Subcode: 1122 (Record has to be locked)
> CallStack:
> ...
> ...
> Error Object created:
> --------------------
> SubSystem :DBFCDX
> SubCode :1122
> GenCode :Lock required
> OsCode :0
> ArgType :NIL
> FuncPtr :0x00000000
> ArgNum :0
> FuncSym :
> Severity :3
> CanDefault :.F.
> CanRetry :.F.
> CanSubstitute :.F.
> Operation :
> Description :
> FileName :
> Tries :1
> FileHandle :0
> SubCodeText :Record has to be locked
>
>
>
> Code:
> nCurrentRecno := SELF:oDCBrowseGrid:oDBServer:Recno
>
> SELF:oDCBrowseGrid:oDBServer:SuspendNotification()
> SELF:oDCBrowseGrid:GoTop()
>
> oWin:= PrintProgress{oSystem:Shell,
> Range{0,oDCBrowseGrid:oDBServer:OrderKeyCount()},int(oDCBrowseGrid:oDBServer:OrderKeyCount()/
> 10)}
> oWin:Show()
>
> DO WHILE !SELF:oDCBrowseGrid:oDBServer:Eof
> IF self:oDCBrowseGrid:oDBServer:Betaald == FALSE
> IF oOutput->(DBAPPEND())
> y := SELF:oDCBrowseGrid:oDBServer:FCount
> FOR n := 1 TO y
> oOutput->(FIELDPUT(n, SELF:oDCBrowseGrid:oDBServer:FIELDGET(n)))
> NEXT n
> ENDIF
> ENDIF
> self:oDCBrowseGrid:oDBServer:Skip(1)
>
> IF oWin:Update()
> EXIT
> ENDIF
>
> ENDDO
>
> oWin:EndDialog()
>
> SELF:oDCBrowseGrid:GoTo(nCurrentRecno)
> SELF:oDCBrowseGrid:oDBServer:ResetNotification()
>
> oOutput->(DBCREATEORDER("FACTUURNR",oSystem:workdir +
> "\FACTUREN.CDX","FACTUURNR"))
>
>
> oOutput->(DBCLOSEAREA())

From: Takumo on
Hi!
More over - check if your database is shared and opened somewhere
else.
As help says: "Shared mode: For a shared database, this function
requires a record lock. Refer to the "Concurrency Control" chapter in
the Programmer's Guide for more information on locking".

If this mixed approach works in other parts of your code, check return
value of DBAppend() and NetErr() state . There may be an error in
dbappend because it should lock an appended record automatically. If
the lock fails, the prog execution continues and you may get an error
message somewhere in the rest part of your code.

HTH.
From: Woerdie on
On 1 apr, 00:04, Takumo <advokat.b...(a)gmail.com> wrote:
> Hi!
> More over - check if your database is shared and opened somewhere
> else.
> As help says: "Shared mode: For a shared database, this function
> requires a record lock.  Refer to the "Concurrency Control" chapter in
> the Programmer's Guide for more information on locking".
>
> If this mixed approach works in other parts of your code, check return
> value of DBAppend() and NetErr() state . There may be an error in
> dbappend because it should lock an appended record automatically. If
> the lock fails, the prog execution continues and you may get an error
> message somewhere in the rest part of your code.
>
> HTH.


When I Try
oOutput:Append()
.....
oOutput:Fieldput(n,SELF:oDCBrowseGrid:oDBServer:FIELDGET(n))

VO says: Unknown valriable oOUTPUT


Init oOutput =

oFileToClone := Facturen{}
aDBStructure := {}
aDBStructure := oFileToClone:DBStruct

DBCREATE(oSystem:WorkDir + "\FACTUREN.DBF", aDBStructure, "DBFCDX",
TRUE, "oOutput")
oFileToClone:Close()
 |  Next  |  Last
Pages: 1 2 3 4
Prev: Spinners
Next: Exchange