Handle Advanced Arrays With RDS

Handle Advanced Arrays With RDS

Often you need a data structure similar to a two-dimensioned array or collection, but you need to manipulate it. For example, you need to sort on certain columns, filter certain rows, or find certain values. These functionalities are already available in the ADO Recordset object. The Microsoft Remote Data Services provides a way to store nondatabase data in a recordset using the DataFactory object. This class can help you create in-memory recordsets. Set the reference to Microsoft Remote Data Services Server 2.1 Library:

 ' code forRInMemoryRSOption ExplicitPrivate df As New RDSServer.DataFactoryPrivate vColInfo()Private nTotalCols As LongPublic Function Create() As ADODB.Recordset	If nTotalCols > 0 Then		Set Create = df.CreateRecordSet(vColInfo)	End IfEnd FunctionPublic Sub Clear()	ReDim vColInfo(0)	nTotalCols = 0End SubPublic Sub AddColumn(szName As String, _	nColType As ADODB.DataTypeEnum, Optional _	nColSize As Long = -1, Optional bNullable _	As Boolean = True)	Dim vCol(3)	ReDim Preserve vColInfo(nTotalCols)	vCol(0) = szName	vCol(1) = CInt(nColType)	vCol(2) = CInt(nColSize)	vCol(3) = bNullable	vColInfo(nTotalCols) = vCol	nTotalCols = nTotalCols + 1End SubPrivate Sub Class_Initialize()	nTotalCols = 0End Sub

Use code like this:

 Dim rsMem As ADODB.RecordsetDim RMemRS As new RInMemoryRS' Create Two Column TableRMemRS.AddColumn "Name", adChar, 10, FalseRMemRS.AddColumn "Age", adchar, 10Set rsMem=RMemRS.Create' Now, you can add the data to the "Memory ' Recordset" for examplersMem.AddNew rsMem!Name = "John"rsMem!Age = 15rsMem.UpdatersMem.AddNew rsMem!Name = "Kevin"rsMem!Age = 25rsMem.Update

You can manipulate rsMem like this:

 rsMem.Filter = "Age > 15"rsMem.Sort = "Age ASC"rsMem.Save szFileNamersMem.Find "Name = 'John'"
Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes