If you want to retrieve the UserID and UserName, and assuming they're the only two fields retrieved, simply do this:

Dim ReadUserName as String
Dim ReadUserID as String
If Reader.Read then
ReadUserID = Reader(0) 'This is the first field returned, most likely UserID
ReadUserName = Reader(1) 'This is the second field returned
End If

You can also substitute the integer values within Reader() with string values that are the actual column names. Like so:

Dim ReadUserName as String
Dim ReadUserID as String
If Reader.Read then
ReadUserID = Reader("UserID") 'This is the first field returned, most likely UserID
ReadUserName = Reader("UserName") 'This is the second field returned
End If

Hi
As I understand it you are passing a query into your class and wish to read the data from it. It looks to me like the issue is caused here:

Dim i As Integer = -1
While MySQLreader.Read
i += 1
ReadData += MySQLreader.GetValue(i).ToString
End While

1.The line While MySQLreader.Read will cause the reader to read from each row in turn
2. You are not moving through each field returned with the record as your i value is not increasing within the record.
3. I also would not assume a value limit for i so that you can pass queries with various number of fields in the result.

Here is how I would do it:

Dim ReadData As String
Dim i As Integer
While MySQLreader.Read 'Read in the row
i=0 'reset i to start from first field
'loop through each returned field and add to the string
for i = 0 to MSQLreader.FieldCount - 1
ReadData += MySQLreader.Item(i).ToString
next
End While
Return ReadData

Hi
As I understand it you are passing a query into your class and wish to read the data from it. It looks to me like the issue is caused here:

Dim i As Integer = -1
While MySQLreader.Read
i += 1
ReadData += MySQLreader.GetValue(i).ToString
End While

1.The line While MySQLreader.Read will cause the reader to read from each row in turn
2. You are not moving through each field returned with the record as your i value is not increasing within the record.
3. I also would not assume a value limit for i so that you can pass queries with various number of fields in the result.

Here is how I would do it:

Dim ReadData As String
Dim i As Integer
While MySQLreader.Read 'Read in the row
i=0 'reset i to start from first field
'loop through each returned field and add to the string
for i = 0 to MSQLreader.FieldCount - 1
ReadData += MySQLreader.Item(i).ToString
next
End While
Return ReadData

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...