Ok, me again. When I add the records into the database, I am getting the aryFields(#) instead the called index in the array. I look at everything and can't see why I'm not getting the desired data instead of the aryFields() written into the database. Uugh.

Private Sub btnLoadFromText_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoadFromText.Click
        'declare the database
        Dim db As New dbUpdt
        Dim strRecord As String    ' for each line (record) from the CSV file
        Dim aryFields() As String ' array to contain fields
        Dim strID As String       ' for the station ID
        'declare the source of the database file

        'create connection to the database
        'open & read text
        Dim stationsFile As StreamReader = File.OpenText("stationsIn.csv")
        ' continue processing until I hit the end of CSV file
        Do Until stationsFile.EndOfStream

            ' read a record and split into fields
            strRecord = stationsFile.ReadLine
            aryFields = Split(strRecord, ",")

            ' Determine the value of the key field
            strID = aryFields(0)
            db.addRecord("stations", "StationID", "aryFields(0)")
            db.setField("stations", "StationID", "aryFields(0)", "StationName", "aryFields(1)")
            db.setField("stations", "StationID", "aryFields(0)", "State", "aryFields(2)")
        ' read one line and store in database
    End Sub
3 Years
Discussion Span
Last Post by dusto

ok, solved my own issue, just removed the quotation marks around the aryFields(#)

db.addRecord("stations", "StationID", aryFields(0))
db.setField("stations", "StationID", aryFields(0), "StationName", aryFields(1))
db.setField("stations", "StationID", aryFields(0), "State", aryFields(2))
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.