标题:
[基础]
[新手求助,急!]关于增加记录问题(VB6升级到VB2005)
[打印本页]
作者:
jhl54
时间:
2007-9-8 16:21
标题:
[新手求助,急!]关于增加记录问题(VB6升级到VB2005)
从VB6升级到VB2005,增加记录时VB6能增加成功,VB2005不能,而且不提示任何错误。用DEBUG跟踪执行的返回值好像也都一样,请各位大虾指点一下原因,多谢!!
VB6:
Set rs = New ADODB.Recordset
CONN.BeginTrans
strSQL = cnstpymtSQL & " where pymt_desc_tx = '" & strFlag & "'"
rs.ActiveConnection = CONN
rs.Open strSQL, , adOpenKeyset, adLockOptimistic, adAsyncFetch
rs.AddNew
rs!PYMT_DTL_ID = clsPmtLineMths.PYMT_DTL_ID
rs!PYMT_DESC_TX = clsPmtLineMths.MANUAL_ADJ_DESC
rs!PYMT_VOL_NB = clsPmtLineMths.MANUAL_ADJ_VOL
rs!PYMT_RT_AM = clsPmtLineMths.MANUAL_ADJ_RT
rs!EXPEN_TYPE_ID = clsPmtLineMths.EXPEN_TYPE_ID
rs!OWN_ID = clsPmtLineMths.OWN_ID
rs!OWN_TP = clsPmtLineMths.OWN_TP
rs!YYYYMM = clsPmtLineMths.YYYYMM
rs!ENTR_DT = Now
rs!UPDT_DT = Now
rs!USR_UPDT_NM = getUsr
rs!Yyyymm_due = clsPmtLineMths.Yyyymm_due
If Not clsPmtLineMths.SAP_ACCT_NB = "Payee Default" Then
rs!SAP_ACCT_NB = clsPmtLineMths.SAP_ACCT_NB
End If
If Not clsPmtLineMths.SAP_COST_CNTR = "Payee Default" Then
rs!SAP_COST_CNTR = clsPmtLineMths.SAP_COST_CNTR
End If
rs.Update
lngAdd = rs!MNL_PYMT_ID
clsPmtLineMths.MNL_PYMT_ID = lngAdd
strKey = "mnl_pymt_" & CStr(lngAdd)
CONN.CommitTrans
VB2005:
rs = New ADODB.Recordset
strSQL = cnstpymtSQL & " where pymt_desc_tx = '" & strFlag & "'"
rs.let_ActiveConnection(CONN)
rs.Open(strSQL, , ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic, ADODB.ExecuteOptionEnum.adAsyncFetch)
rs.AddNew()
rs.Fields("PYMT_DTL_ID").Value = clsPmtLineMths.PYMT_DTL_ID
rs.Fields("PYMT_DESC_TX").Value = clsPmtLineMths.MANUAL_ADJ_DESC
rs.Fields("PYMT_VOL_NB").Value = clsPmtLineMths.MANUAL_ADJ_VOL
rs.Fields("PYMT_RT_AM").Value = clsPmtLineMths.MANUAL_ADJ_RT
rs.Fields("EXPEN_TYPE_ID").Value = clsPmtLineMths.EXPEN_TYPE_ID
rs.Fields("OWN_ID").Value = clsPmtLineMths.OWN_ID
rs.Fields("OWN_TP").Value = clsPmtLineMths.OWN_TP
rs.Fields("YYYYMM").Value = clsPmtLineMths.YYYYMM
rs.Fields("ENTR_DT").Value = Now
rs.Fields("UPDT_DT").Value = Now
rs.Fields("USR_UPDT_NM").Value = getUsr
rs.Fields("Yyyymm_due").Value = clsPmtLineMths.Yyyymm_due
If Not clsPmtLineMths.SAP_ACCT_NB = "Payee Default" Then
rs.Fields("SAP_ACCT_NB").Value = clsPmtLineMths.SAP_ACCT_NB
End If
If Not clsPmtLineMths.SAP_COST_CNTR = "Payee Default" Then
rs.Fields("SAP_COST_CNTR").Value = clsPmtLineMths.SAP_COST_CNTR
End If
rs.Update()
lngAdd = rs.Fields("MNL_PYMT_ID").Value
clsPmtLineMths.MNL_PYMT_ID = lngAdd
strKey = "mnl_pymt_" & CStr(lngAdd)
CONN.CommitTrans()
作者:
Nothing
时间:
2007-9-8 19:26
rs.Open(strSQL, , ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic, ADODB.ExecuteOptionEnum.adAsyncFetch)
看看这句的打开参数
作者:
jhl54
时间:
2007-9-9 12:42
不好意思,能请教一下具体怎么看吗?
作者:
Nothing
时间:
2007-9-9 19:03
你多试试这里面的只个参数。
欢迎光临 编程开发论坛 (http://bbs.lihuasoft.net/)
Powered by Discuz! 6.0.0