andrewzeng
16th November 2005, 03:17
When I Use this Funcnction

then Record is Created ,But Whwmd957.Comm Is nothing


function InsertData(domain whwmd.nodrno odno,domain whwmd.nodlno odln,string mtno,domain whwmd.nodtp odtp,domain whwmd.nstr100 odnm,domain whwmd.npkunt pkut,domain whwmd.nqty pknm,domain whwmd.nstr100 comm)
{

long tableid
db.retry.point()
tableid = db.bind("twhwmd957")

if tableid>0 then

string pkid(20)
domain whwmd.nboid pkid
pkid = getnewid()

db.insert(tableid,DB.RETRY)

whwmd957.pfid = pkid
whwmd957.odno = odno
whwmd957.odln = odln
whwmd957.mtno = mtno
whwmd957.odtp = odtp
whwmd957.odnm = odnm
whwmd957.pkut = pkut
whwmd957.pknm = pknm
whwmd957.comm = comm |this is multibyte strings

commit.transaction()
else
message("Binding Error")
endif
}

beginer
16th November 2005, 08:30
Hi,

How is it that db.insert() is written before assigning the fields ????

I suppose the record should not be created at all.

en@frrom
16th November 2005, 10:07
You should first assign the correct field values, and only after that you should use db.insert().

andrewzeng
21st November 2005, 02:41
Record Is really created

Youp2001
21st November 2005, 11:41
Ok, it can be that the record is created, but in order to create it with the correct values you should first assign all fields the correct value before doing an insert.

If this is not possible for some reason you could first insert the record, add the field values and do an update of the record (make sure you have read the correct record for updating first with locking).

Youp

baanbomb
25th November 2005, 09:49
may be you should use mb.import$() or mb.export$() or mb.cast.to.str$( string_expr )
to convert your Comm string first.
FYI:mb.import$(Comm,Comm)
Whwmd957.Comm = comm
db.insert(tableid,DB.RETRY)