mercredi 14 décembre 2016

VB.Net: Setting Class Variables from a RecordSet

I have a class with variables...

Public ClassnTriangle
    Dim issueNumber As String 'Risk_ID
    Dim issueName As String   'Proposed Risk Name
    Dim activityNumber As Integer 
    Dim postActivityConsequence As Integer  'Activity "n" Cost Consequence
    Dim activityDate As String         'Activity "n" Start Date
    Dim activityDescription As String  'Activity "n" description

And a recordset that is populated from the joining of data on two excel sheets using this query...

getRecordSet = MyADO.executeQuery("Select [Risk_ID],[Proposed Risk Name], [Activity 1 Description], [Activity 1 Start Date], [Activity 1 Cost Consequence], [Activity 2 Description], [Activity 2 Start Date], [Activity 2 Cost Consequence], [Activity 3 Description], [Activity 3 Start Date], [Activity 3 Cost Consequence], [Activity 4 Description], [Activity 4 Start Date], [Activity 4 Cost Consequence] from [Risk Register$A4:BM8] as table1 left join [Risk Reduction Activities$A4:BA8] as table2 on table1.[Risk ID] = table2.[Risk_ID]")

I'm having a hard time thinking of an easy (non-ugly) way of populating four triangle objects with corresponding data from the RecordSet. Of course, I could do an ugly if,elif,else, statement, but was hoping there was an alternative out there.

Aucun commentaire:

Enregistrer un commentaire