I'm not sure what this line means:
'Console.WriteLine("{0} - {1}", reader.GetString(0), reader.GetString(1))
Console.WriteLine takes a format string. See String.Format for more
information. The numbers in braces are parameter numbers. In the
code above, {0} is replaced by the next parameter, reader.GetString(0)
(the value of column 0) and {1} by reader.GetString(1) (the value of
column 1).
So to assign say a dataview grid to this set of records is it just
Me.DataGridView1.DataSource = reader because I don't get anything back with
that?
No. A DataReader supplies one row each time. For more information on
this see
<
http://msdn.microsoft.com/en-us/library/haa3afyz(VS.71).aspx>.
The DataGridView.DataSource property takes some kind of list. You
must iterate through the DataReader and populate some kind of list. A
good one to use is BindingList(Of T), as that supplies a lot of
functionality that is useful when binding controls to a list.
However since you are just getting started with VB .NET, it might be
easier for you to create a DataSet from the DataReader using a
DataAdapter, and bind the DataGridView to the DataSet's DataTable.
Here is some information about this
<
http://msdn.microsoft.com/en-us/library/bh8kx08z.aspx>
By using Google you should be able to find more examples.
Also, it is probably not necessary to specify the data type on the
Parameters.Add call. I know it is not necessary with SQL Server, but
I'm not sure about OleDB. You probably can just use:
Cmd.Parameters.Add(New OleDb.OleDbParameter("@fn", "Joe"))