lostboy wrote:
v8.1 windows
ado insert
sequences
CODE
sSQL = "select * from form_structure where form_id = '" & nHeaderID
& "' and field_name = '" & sFldName & "' "
'use ADO to get the record id number back
rsForm.open sSQL, PortalDB, adOpenDynamic, adLockOptimistic
if rsForm.EOF and rsForm.BOF then
rsForm.AddNew
' sThisSortOrder = 999 'move the newly added record to last
place
end if
rsForm("field_name") = lcase(sFldName)
rsForm("sort_order") = nSortCounter 'current sort order
rsForm("form_id") = nHeaderID
rsForm("data_type") = lcase(sDefaultDataType)
rsForm.Update
nFormStructRecId = rsForm("record_id")
Bastien
Bear with me I'm ADO ignorant.
If you are using sequence how do you generate teh new value?
Do you have an INSERT trigger on FORM_STRUCTURE?
You can get the value back through two means:
Select back "SELECT PREVIOUS VALUE FOR <seqname> FROM SYSIBM.SYSDUMMY1"
or Do the insert expliictly:
SELECT <idcol> FROM NEW TABLE(INSERT INTO FORM_STRUCTURE .....)
Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab