Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DBError Event Won't fire on datastore update error

1,008 views
Skip to first unread message

KPK

unread,
Oct 16, 2003, 6:24:08 PM10/16/03
to
I have a user object (nvo) which inherits from datastore. I have a
public function that connects to SQL Server, populates my datastore
object. I then try to insert a new row of data into the datastore and
update the database, but my return value is -1 on the row in my code
where the update method is called. The blasted DBError event WON'T
fire to tell me what the error is!!!!!! Any suggestions? (I have PB 7
with the latest service packs.)

Here is my code:

string strSyntax, strError, strSQL
datastore dsObject
long lngInsertedRow, x1

dsObject = create datastore

strSQL = 'select * from testtable'
strSyntax = sqlca.SyntaxFromSQL(strSQL, 'style(type=grid)', strError)

if strError <> '' then
messagebox('Error', strError)
else
dsObject.reset()
dsObject.Create(strSyntax, strError)
dsObject.settransobject(sqlca)
dsObject.retrieve()
end if

if dsObject.rowcount() > 0 then
lngInsertedRow = dsobject.insertrow(0)

if lngInsertedRow > 0 then
//messagebox('number', string(dsObject.getitemnumber(1, 'col1')))
//messagebox('date', string(dsObject.getitemdatetime(1, 'col2')))

//messagebox('number', string(dsObject.getitemnumber(2, 'col1')))
//messagebox('date', string(dsObject.getitemdatetime(2, 'col2')))

dsobject.setitem(lngInsertedRow, 'col1', 3)
dsobject.setitem(lngInsertedRow, 'col2', date('10/16/2003
00:00:00'))

x1 = dsObject.update() // this is where the error occurs!
end if
end if

destroy(dsObject)

Bhadresh

unread,
Oct 22, 2003, 10:14:44 AM10/22/03
to
You are using
dsObject = create datastore

you should use
dsObject = create uo_nv_datastore // where uo_nv_datastore is the
user object you have inherited from the datastore, in which you have
coded your dberror event

0 new messages