有段代码不明白什么意思,请指教!
Private Sub Loadcontrol(lPage As Long)
Dim adoPrimaryRS As ADODB.Recordset
Dim lPageCount As Long
Dim nPageSize As Integer
Dim lCount As Long
'每页显示的纪录
nPageSize = 30
Set adoPrimaryRS = New ADODB.Recordset
adoPrimaryRS.Open "select * from ask ", conn, adOpenStatic, adLockOptimistic
adoPrimaryRS.PageSize = nPageSize
'页数
lPageCount = adoPrimaryRS.PageCount
If lCurrentPage > lPageCount Then
lCurrentPage = lPageCount
End If
adoPrimaryRS.AbsolutePage = lCurrentPage
'定义另一个记录集
Dim objrs As New ADODB.Recordset
'添加字段名称
For lCount = 0 To adoPrimaryRS.Fields.Count - 1
objrs.Fields.Append adoPrimaryRS.Fields(lCount).Name, adVarChar, adoPrimaryRS.Fields(lCount).DefinedSize
Next
'打开记录集
objrs.Open
'将指定记录数循环添加到objrs中
For lCount = 1 To nPageSize
If adoPrimaryRS.EOF Or adoPrimaryRS.BOF Then
Exit For
Else
objrs.AddNew
objrs!姓名 = adoPrimaryRS!姓名
objrs!密码 = adoPrimaryRS!密码
adoPrimaryRS.MoveNext
End If
Next
'绑定
Set DataGrid1.DataSource = objrs
'在文本框显示页数
txtPage = lPage & "/ " & adoPrimaryRS.PageCount
End Sub
以下这段代码是什么意思,
objrs.Fields.Append adoPrimaryRS.Fields(lCount).Name, adVarChar, adoPrimaryRS.Fields(lCount).DefinedSize
[解决办法]
追加字段,名稱,類型,長度