开发者

Trying to create a DAO recordset from an array

I'm using VB6 and trying to create a DAO recordset from an array of data. I want something like this but I've hit all kinds of problems

Dim rst As DAO.Recordset
Dim tdf As New DAO.TableDef
Dim fld As New DAO.Field

rst.Fields.Append tdf.CreateField(arrayHeader(0), adInteger, 5)
rst.OpenRecordset

rst.AddNew Array(arrayHeader(0), arrayHeader(1)), Array (arrData(0), arrData(1))

Code is simplified to highlight the problem I have. Arrays are declared and have data in t开发者_JAVA百科hem. Problem at the moment is trying to add the field to the recordset. Is it possible to have a disconnected DAO RecordSet like this? I have to use DAO for various reasons that really aren't worth getting into.


It is not possible to fabricate a DAO Recordset in that way. A DAO Recordset cannot be disconnected; it needs to be always connected to a data source.

For what it's worth, a disconnected ADODB Recordset can be fabricated in almost exactly the way you have coded.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜