schotime / NPoco

Simple microORM that maps the results of a query onto a POCO object. Project based on Schotime's branch of PetaPoco
Apache License 2.0
848 stars 302 forks source link

No database type found for the type string specified: 'SqlServerDatabaseType'. Make sure the relevant assembly NPoco.SqlServer is referenced. #614

Closed mchomem closed 3 years ago

mchomem commented 3 years ago

Hello dears!

I made the adjustment you indicated but even so when trying to connect to the bank, I am receiving the following exception from the application:

System.Exception: 'No database type found for the type string specified:' SqlServerDatabaseType '. Make sure the relevant assembly NPoco.SqlServer is referenced. '

Could you tell me what I'm doing wrong?

Follow my code:

public List<Employee> Retreave(Employee entity)
{
    using (IDatabase db = new Database(@"Server=SERVER\SQL2019; Database=tEST;User Id=sa;Password=sa@2019;", DatabaseType.SqlServer2012, System.Data.SqlClient.SqlClientFactory.Instance))
    {
        return db.Fetch<Employee>("select * from Employee");
    }
}

My database is Sql Serve 2019, in this wiki: https://github.com/schotime/NPoco/wiki/Database-Constructor-Alternates it is clear that it would not be my version of Sql 2019 that would be causing the failure.

schotime commented 3 years ago

You must reference the NPoco.SqlServer nuget package as suggested. Its probably easier to also call new SqlServerDatabase("connString")

I'll make a wiki for it.

mchomem commented 3 years ago

It worked!!!!

Thank you very much @schotime !

I will close this issue!