|
本帖最后由 mclly2000 于 2013-6-4 01:22 编辑
窗体绑定的记录集来自ado(使用存储过程获取数据即cmd.Execute),窗体获取记录集后无法编辑,关于锁的类型,游标位置,游标类型的设置都是正确的。看到这个帖子http://bbs.csdn.net/topics/90117687
说用command.execute产生的recordset是不能更新的,只能使用recordset.open或RecordSet =connection.execute.
由于我这个查询呢比较复杂需要使用存储过程,请教论坛老师可有什么办法让返回的记录集可更新。
原代码如下:
- <P>Private Sub Form_Load()
- Dim CmdUntread As New ADODB.Command
- Dim RsUntread As New ADODB.Recordset
- Dim pUntread01 As ADODB.Parameter
- Dim pUntread02 As ADODB.Parameter
- RsUntread.LockType = adLockBatchOptimistic
- RsUntread.CursorType = adOpenStatic
- RsUntread.CursorLocation = adUseClient
- CmdUntread.ActiveConnection = NetDS'激活连接
- CmdUntread.CommandText = "proc_HeaveyPerson_ReplyUntreadMsg @username=?,@CaseNumber=?"
- Set pUntread01 = CmdUntread.CreateParameter(Type:=adVarChar, Size:=10)
- CmdUntread.Parameters.Append pUntread01
- CmdUntread.Parameters(0) = "10000"
- Set pUntread02 = CmdUntread.CreateParameter(Type:=adVarChar, Size:=30)
- CmdUntread.Parameters.Append pUntread02
- CmdUntread.Parameters(1) = "C342500VEH13000986"
- CmdUntread.Execute
- RsUntread.Open CmdUntread
- Set Me.Recordset = RsUntread
- Me.Refresh
- Set RsUntread = Nothing
- End Sub</P>
复制代码 |
|