Public Sub ReadMyData(ByVal myConnString As String)
Dim sugarConnection As New SugarConnection(myConnString)
Dim sugarCommand As SugarCommand = sugarConnection.CreateCommand()
sugarCommand.CommandText = "SELECT id, name, status FROM Campaigns"
sugarConnection.Open()
Dim sugarReader As SugarDataReader = sugarCommand.ExecuteReader()
Try
' Always call Read before accessing data.
While sugarReader.Read()
Console.WriteLine(String.Concat(sugarReader.GetGuid(0).ToString(), " ", _
sugarReader.GetString(1), " ", sugarReader.GetString(2)))
End While
Finally
' always call Close when done reading.
sugarReader.Close()
' Close the connection when done with it.
sugarConnection.Close()
End Try
End Sub