Linq2db: i need return DataTable

Created on 2 Mar 2020  ·  5Comments  ·  Source: linq2db/linq2db

hi

how can use DataTable to call store for store procedure
not like #1645

    public static IEnumerable<DataTable> spReportpAGEvISITcOUNT(this db dataConnection)
        {
            return dataConnection.QueryProc<DataTable>("spName");
        }
question

Most helpful comment

Everything can be found in StackOverflow and analyzing linq2db extension methods:

var dataTable = new DataTable();
using (var reader = dataConnection.ExecuteReader("spName", CommandType.StoredProcedure))
{
    dataTable.Load(reader.Reader);
}

All 5 comments

It ieasy, if you need IQueryable, you do not have to use QueryProc.

return dataConnection.FromSql(“spName”);

i don't need IQueryable

just i need return System.Data.DataTable

because columns is dynamic

Everything can be found in StackOverflow and analyzing linq2db extension methods:

var dataTable = new DataTable();
using (var reader = dataConnection.ExecuteReader("spName", CommandType.StoredProcedure))
{
    dataTable.Load(reader.Reader);
}

Hi @sdanyliv

sorry for a lot question

and tanxxxxxxxxxxxxxxxx

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Scratch-net picture Scratch-net  ·  6Comments

dmzaharov picture dmzaharov  ·  3Comments

bofagah400 picture bofagah400  ·  4Comments

DmitriiGaidukov picture DmitriiGaidukov  ·  4Comments

nviktor picture nviktor  ·  6Comments