[RESOLVED] [NOOB] Simple ado.net question
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: [RESOLVED] [NOOB] Simple ado.net question

  1. #1
    Join Date
    Mar 2007

    [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

    while(not EOF)
    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.

  2. #2
    Join Date
    Mar 2007

    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

    datatable.Columns.Add("Column 1");

    "Column 2");

    "Column 3");

    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 07:55 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This is a Codeguru.com survey!

HTML5 Development Center