Is it Possible to Write SQL Statement against Offline DataSet (there are no DataBase) RRS feed

  • Question

  • Hi every Body

    I have a dataSet filled from XML file and no connection with any dataBase Engine

    I need to make a join or group By or other things I need to use SQL features ?

    when I make AddQuery It Ask for a connection and I have no

    so how can I make Quries on my dataSet

    I heard about LINQ but it is new for me ,

    I am experinced with SQL Ad I want to know if there is any way to treat DataSet as DataBase and write SQL statement against it

    thank you

    Friday, July 9, 2010 11:40 PM


All replies

  • If you are looking for SELECT commands, then DataTable.Select Method will help you at some extend.

    Reference DataTable.Select Method   


    Saturday, July 10, 2010 4:47 AM
  • thank you But I want to ask

    I think select is Capable to be applied on the table that it is called on it and it is unable to make join

    is that right?


    fro example

    Customers.Select()   we can use it to obtain information only from customers not from two tables or more

    Sunday, July 11, 2010 9:35 AM
  • If you are looking for more complicated queries, I would suggest usage of DataRow Filter.

    For example.

    Dim dv as new DataView(
    dv.Table = ds1.Tables(0
    dv.RowFilter = "id = 2 OR firstname LIKE '*th*' OR firstname NOT LIKE 'Mi*'
    dv.Sort = "firstname DESC

    Please have a look at   DataRowFilter Property

    Monday, July 12, 2010 4:39 AM
  • The DataSet does not offer rich query support for scenarios like joins or groupings.  If that is functionality you need for a DataSet, LINQ to DataSet is the right approach.  Here are a couple links for the scenarios you mentioned to help you get started.

    LINQ to DataSet join example:

    LINQ to DataSet group by example:

    I hope this information proves helpful.

    David Sceppa
    Monday, July 12, 2010 9:20 PM