I am trying to parse a CSV file in a VB6 application to update multiple records in a SQL table with an existing form code for writing a single record. CSV files will have a whixh header line, which can be used to check for information coming to the right place in the ADODB record set. In C ++, you can use a map to say how
map<String s, int x> column
column<"First Name", -1>
column<"Last Name",-1>
Then create a counter through comma-separated values, where if the third value is Last Name, then the code can be written to change column <"Last Name", - 1> to column <"Last Name", 3>, and if x ! = -1 on any of the cards, the file is valid for use, I would then scroll through the remaining entries and parse their container using something similar to
strLastName = Array<column[3]>
to assign record values to the correct variables. I'm still very new to VB6, how can I do something like this in VB6 and which containers should I use? Still i
Public Sub GetImportValues()
On Error GoTo GetImportValues_Error:
Dim intFileNum As Integer
Open Path For Input As
Do Until EOF(intFileNum)
Line Input
FunctionThatSavesInformationToSQL
Loop
Close
GetImportValues_Exit:
Exit Sub
GetImportValues_Error:
Err.Source = "frmMemberAdd.GetImportValues" & " | " & Err.Source
Err.Raise Err.Number, Err.Source, Err.Description
End Sub
with a dialog box returning the path as a string using App.path in a separate function
*****************************************.... *** Minor change in answer The collection was aware of what I requested, but I had to change it to a dictionary, because you cannot return items to collections that prevented me from comparing items and changing keys, but the dictionary can. Make sure you use the dictionary that you switch the item and the key.