Skip to content

Microsoft.SqlServer.Types dll not loaded issue with ASP.NET Core and .Net standard #1149

@Ramana2596

Description

@Ramana2596

We have a scenario to load the spatial data from sql in ASP.NET Core and .NET Standard projects. When trying to read the spatial data with sql adapter or reader we get an issue of "Microsoft.Sqlserver.Types is not loaded". We found that the package for this is not available with ASP.NET Core and .Net Standard. Hence could anyone please let us know the solution for this?
Also the nuget package that we use is System.Data.SqlClient and the nuget version is 4.8.0. Please find the sample code below and the exception is thrown when executing the code part present within the highlighted section,

`private System.Data.DataTable GetTable(DbConnection dbConnection, SqlCommand command)
{
using (command.Connection = (SqlConnection)dbConnection)
{
System.Data.DataTable dtable = new System.Data.DataTable();

            using (SqlDataAdapter dAdapter = new SqlDataAdapter(command))
            {
                System.Data.DataSet dset = new System.Data.DataSet();
                dAdapter.Fill(dset);

                if (dset.Tables.Count > 0)
                    dtable = dset.Tables[0];
            }

            return dtable;
        }
    }

`

Please find a snap of the error thrown below,
issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions