A New Data Programming Style

A New Data Programming Style

While working on VB projects with associated Jet databases, I found that I was creating a lot of individual handling functions for reading, writing, and validating data. It was hard to keep track of changes made to the table structures and to their associated handling functions.As a result, I’ve developed new programming style. My read /write and special functions are all in one routine selected by case logic based on descriptive strings. The strings are used only within the programs and are self documenting to some extent. Data is passed through a Public WorkVariant array:

 Public MyDB As DatabasePublic WorkVariant(10) As VariantDim Dummy As IntegerSet MyDB = OpenDatabase("testjet3db")'Sample callsDummy = NameTableIO("writerecord")Dummy = NameTableIO("readrecord")Public Function NameTableIO_	(ByVal whichAction As String) As Integer'Assumes navigation to the record has 'been made externallyDim MyTable As RecordsetDim ErrorStage As StringOn Error GoTo NameTableIOError	NameTableIO = True	ErrorStage = "OpenRecordSet"	Set MyTable = MyDB.OpenRecordset("NameTable")	ErrorStage = "AfterOpen"	Select Case whichAction		Case "readrecord"			WorkVariant(1) = MyTable![FirstName]			WorkVariant(2) = MyTable![Age]		Case "writerecord"			MyTable.Edit				MyTable![FirstName] = WorkVariant(1)				MyTable![Age] = WorkVariant(2)			MyTable.UpdateCase "validateage"	'specialized routine		'etcEnd SelectNameTableIOErrorExit:	If ErrorStage <> "OpenRecordSet" Then		MyTable.Close	End If	Set MyTable = NothingExit FunctionNameTableIOError:	NameTableIO = False	MsgBox Error$ &_		" Error trap in NameTableIO " & _		"at " & ErrorStage & " Action: " & whichAction	Resume NameTableIOErrorExitEnd Function
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