0

I am building an web application using ASP.NET5 MVC6 and Classic Ado.Net. But we could not take reference of System.Data. Only two packages are available in nuget packages

System.Data.Common and System.Data.SqlClient.

In addition to that, whenever I add System.Data.Common from nuget, my project is not compiling.

I need DataSet and Datatable in the controller's action method.

How could we get this in Asp.Net 5 ?

I have got answer from this question.

Community
  • 1
  • 1
s.k.paul
  • 7,099
  • 28
  • 93
  • 168

1 Answers1

0

The current version of System.Data.Common and System.Data.SqlClient. are conflicting with other asp.net-5 libraries.

You can use EF7 and use the connection object from the DBConect.Database

        var conn = DbContext.Database.GetDbConnection();
        var cmd=conn.CreateCommand();
        cmd.CommandText = "SELECT 1";
        conn.Open();
        var dr = cmd.ExecuteReader();
        conn.Close();
Thom Kiesewetter
  • 6,703
  • 3
  • 28
  • 41
  • I have added "EntityFramework.Core": "7.0.0-beta8" in project.json. But var conn = DbContext.Database.GetDbConnection(); creates error. – s.k.paul Nov 09 '15 at 05:58
  • See web template how to setup a DBContext. you need first initialize EF7 with a connectionstring – Thom Kiesewetter Nov 09 '15 at 17:11