This is a really simple question I am sure, so please bear with me. I have created a local database in visual studio 2010. I have created a table with columns (c1,c2). I have also created a dataset using VS’s wizard. This includes a ListTableAdapter. I am able to fill the database with values, but I am unable to get all of the rows in c2. Could anyone provide an example of getting a collection of rows from a specified column in c#? Please let me know if you need clarifying details.
This is a really simple question I am sure, so please bear with me.
Share
Columns don’t have rows. You iterate through rows and choose the field.
e.g. something like
What type do you want and how do you want to deal with nulls will be a consideration.
Bear in mind that ColumnName in the table being fieldName in the datatable is a default.
Equally columns have native types, but a field in a DataRow is an object, which if null in the database will be set to DBNull.Value.