Baanboard.com

Go Back   Baanboard.com > Forum > Baan Quick Support: Functional & Technical > Tools Development

User login

Frontpage Sponsor

Main

Poll
Would you like to see a separate forum on Baanboard for the ION product?
No
13%
Yes
87%
Total votes: 90

Baanboard at LinkedIn


Reference Content

Reply
 
Thread Tools Display Modes
  #1  
Old 9th January 2009, 22:17
ben.kansas's Avatar
ben.kansas ben.kansas is offline
Member
 
Join Date: Aug 2007
Posts: 44
ben.kansas is on a distinguished road
Baan: LN, Baan IV - DB: SQL Server - OS: Windows 7
Updating a record via the DAL(2)
Baan: ERP LN 6.1
C/S: Server

Hi All,

I am attempting to update a table using data from a flat file via the DAL.

My code reads:

Code:
        error.found = dal.change.object("tiedm110")
	
	if error.found then
		error.mess = "Could not do 'change object' for refdes line"
		error.mess = dal.error.file
	endif
	
	dal.set.field("tiedm110.eitm", mitm)
	dal.set.field("tiedm110.revi", revi)
	dal.set.field("tiedm110.pono", pono)
	dal.set.field("tiedm110.rdsp", rdsp)
	
	error.found = dal.save.object("tiedm110")
	
	if error.found then
		while dal.get.first.error.message( msg, code) >= 0
			message(msg)
		endwhile
		error.mess = "Could not save REFDES line"
		error.mess = dal.error.file
	else
		commit.transaction()
	endif
When the script try to execute the dal.save.object() function it throws the error that the record is not locked.

I would think that the dal.save.object() function would lock or delay lock the record prior to saving the object.

How can I lock the record so that the record can be modified and then committed to the database?

Thanks for your time,
Ben
Reply With Quote
  #2  
Old 12th January 2009, 06:58
ks_ks_ ks_ks_ is offline
Senior Member
 
Join Date: Jan 2007
Posts: 139
ks_ks_ is on a distinguished road
Baan: Baan 5 - DB: Oracle 9i - OS: Win NT
could you debug this and find out which line is the script throwing the error.
Reply With Quote
  #3  
Old 12th January 2009, 07:53
pconde pconde is offline
Senior Member
 
Join Date: May 2002
Location: Belgium
Posts: 158
pconde is on a distinguished road
Baan: BaanIVc4, BaanERP 5.0, ERP LN6.1 - DB: Oracle, informix, DB400 - OS: unix, As400, windows 2003
Hi,

If you are using dal to update a record you need first to read this record via
select tablename.*
from tablename for update
where ....

Regards
Philippe
Reply With Quote
Sponsored Links
  #4  
Old 12th January 2009, 10:04
NirajKakodkar's Avatar
NirajKakodkar NirajKakodkar is offline
Guru
 
Join Date: May 2006
Location: Mumbai
Posts: 331
NirajKakodkar is on a distinguished road
Baan: BAAN4C4 , BAAN 5c , LN 6.1 - DB: MS SQL SERVER, ORACLE, Informix, HP Unix, AIX - OS: Windows, UNIX
Hello Ben,

If you want to directly insert a new record , you can use the same code with a small change "dal.new.object("tiedm110")" and it will work ,
but here in this case you get a "record not locked error" , this is because while trying to update , the system do not find the record which you are trying to update so as Pconde suggested you will need to select the record for updating ....

Regards,
Niraj
__________________

Niraj N. S. Kakodkar |HOME
----------------------------------
Wordpress |Google+|Twitter
Reply With Quote
  #5  
Old 12th January 2009, 14:13
ben.kansas's Avatar
ben.kansas ben.kansas is offline
Member
 
Join Date: Aug 2007
Posts: 44
ben.kansas is on a distinguished road
Baan: LN, Baan IV - DB: SQL Server - OS: Windows 7
Thanks, Niraj, Philippe.

That solved my problem.

Thanks a million!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Standard Table to Customize Table jaycee99 Tools Development 5 6th November 2008 11:22
Updating specific record in a Multi-View-Occ Cancoon2000 Tools Development 2 8th December 2006 20:36
How to delete record in scheme? yurong Tools Administration & Installation 4 30th December 2004 23:35
Record buffers - more info Praveen Tools Development 3 25th February 2003 21:21


All times are GMT +2. The time now is 17:56.


©2001-2013 - Baanboard.com - Baanforums.com