Trying to get response from my azure db I am using the recommended microsoft snippet
Dim sb As StringBuilder = New StringBuilder()
sb.Append("select top 1 runname from vNameCode")
'sb.Append("where untgscod = ")
Dim sql As String = sb.ToString()
Using command As SqlCommand = New SqlCommand(sql, connection)
Using reader As SqlDataReader = command.ExecuteReader()
While reader.Read()
Console.WriteLine("{0} {1}", reader.GetString(0), reader.GetString(1))
End While
but as soon as I try to read the values I get the error:
System.IndexOutOfRangeException: 'Index was outside the bounds of the array.'
I get an object back but just cannot read it in the recommended way. Any ideas what I am doing wrong?