表中添加过新记录以后可以立即拿出新记录的属性吗?
'打开数据集,检查大类是否存在,若不存在则添加
AddPayoutInfo.Open "tbGoods_BigClass", g_Conn, adOpenStatic, adLockOptimistic
DBstr = "SELECT Goods_BigClassIDint, Goods_BigClassNamestr FROM tbGoods_BigClass"
Set AddPayoutInfo = g_Conn.Execute(DBstr)
While Not AddPayoutInfo.EOF
If Me.cmbGoodsBigClass.Text <> AddPayoutInfo.Fields.Item(1).Value Then '不匹配
AddPayoutInfo.MoveNext
i = 0
Else '匹配,跳转到Judge1
bigclassid = AddPayoutInfo.Fields.Item(0).Value
MsgBox bigclassid
i = 1
GoTo Judge1
End If
Wend
Judge1: '若是新大类,则跳转到此
If i = 0 Then
g_Conn.Execute "INSERT INTO tbGoods_BigClass VALUES ('" & Me.cmbGoodsBigClass.Text & "')"
End If
AddPayoutInfo.Close
表中tbGoods_BigClass只有Goods_BigClassIDint, Goods_BigClassNamestr两个属性,前者为自动增加(主键)
以上代码通过,我想在添加过记录后,马上就返回主键值,但是直接取好像会提示“行集不支持反向提取”,这是问什么?
大家帮下忙,谢谢