April 21st, 2007, 02:18 PM
[RESOLVED] [NOOB] Simple ado.net question
How do I add data that is in memory to a dataset so that I can execute sql queries on it in order to return something that I can manage in a while or foreach loop?
Basically I have a file with data, that I'd like to be able to execute sql on to sort it. Something along these lines
Read data from file
add data to dataset
execute query on dataset
foreach row in dataset
create a treeview node for row.field
This should be simple.
April 21st, 2007, 03:13 PM
Re: [NOOB] Simple ado.net question
Nevermind. I figured it out.
Create a dataset
DataSet dataset = newDataSet("My Dataset");
Create a table
DataTable datatable = dataKeyLog.Tables.Add("My Data Table");
Add columns to table
Create a new row
DataRow row = datatable.NewRow();
Populate the new row with data
row["Column 1"] = "whatever data is appropriate"
row["Column 2"] = "whatever data is appropriate"
row["Column 3"] = "whatever data is appropriate"
Add the row to the table
Create a data view
DataView dataview = newDataView();
dataview.Table = datatable;
Last edited by Traps; April 21st, 2007 at 08:55 PM.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.