I have successfully got the data reader connected but i cannot figure out how to write the values to an array or variables on a windows form created in Visual C# Express edition all examples use the console.
Can someone show me an example of how to write these values to an array so that i can use that as my starting point to initialize the values on the windows form? This is really new to me and a little confusing.
I create an array of object that is populated by the current row when using the GetValues method of the SQLDataReader.
I have a set of constants to identify specif columns from the row, however you can use quoted column names instead.
A nice little trick is to save the entire row into the TAG property of my treeview as shown below. while ...Read() is the same thing as while not data.eof.
SqlDataReader ogRdr = command.ExecuteReader();
Object values = new Object[ogRdr.FieldCount];
node = treeOperGroup.Nodes.Add((string)ogRdr[COL_OPERGROUPNAME]);
node.Tag = values;