Run SQL queries in DataTables or similar in .Net without RDBMS

I would like to have a dataset or datatables and be able to run SQL queries on them without using any external RDBMS.

For example, to take 2 datasets in a dataset and simply join them directly with an SQL statement and a Where statement, will the result be a new data type? For example, if I have 2 datatables called People and Addresses in a dataset (which I created using code without getting from the database .. pardon old-fashioned connection syntax):

dim dtJoined as DataTable = MyDataSet.RunSQLQuery ("Select * from People, Orders Where People.PersonID=Orders.OrdereID")

thank

+3
source share
3 answers

sql, datatables, LINQ to DataSet

+3

SQL , RDBMS, , , , , LINQ.

+2

You can write it to temp csv file and read it with OLEDB

string strCSVConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
            + fileDirectory + ";Extended Properties='text;HDR=YES;'";

OleDbDataAdapter oleda = new OleDbDataAdapter(sql, strCSVConnString);
DataTable dataTable = new DataTable();
oleda.Fill(dataTable);

In this case, sql may be

SELECT * FROM fileName WHERE col = value

etc .. We have had great success with this.

+1
source

Source: https://habr.com/ru/post/1749284/


All Articles