mercredi 20 avril 2016

Assign variable to data

I'm trying to identify if data(0) = X1 then I would like to assign the value of data(1) = Y1 to a string(MyString1). So I later on can call MyString1, and then the value of MyString1 corresponds to Y1. And I should be able to repeat his procedure:

if data(0) = X2 then data(1) = Y2 should be assigned to MyString2 and so on.

I've simplified the data, they are more specific than X1 and Y1.

I've added my code below.

Dim cmd As Odbc.OdbcCommand = New Odbc.OdbcCommand(mystring, conn)
Dim reader As Odbc.OdbcDataReader
Dim columnCount As Integer
Dim output As String
Dim data As Object() = New Object(10) {}
conn.Open()
MsgBox("Connection Established!")
reader = cmd.ExecuteReader()
While reader.Read()
    columnCount = reader.GetValues(data)
    output = ""
    Debug.WriteLine(data(0))
    Debug.WriteLine(data(1))
    For i As Integer = 0 To columnCount - 1
        output = output & " " & data(i).ToString()
    Next
        My.Forms.Form2.TypeTextBox.Text = output
    End While
    conn.Close()

I hope this makes sense.

Aucun commentaire:

Enregistrer un commentaire