Unable to use dapper, "Several methods are applicable"

.net c# dapper

Question

I'm trying to use Dapper to do simple CRUD operations to a SQLite database, but I'm having trouble because the compiler is accusing a error that I simply dont know how to fix.

The error in questions is in the "conn.Execute..." line and it says:

C#: Several methods are applicable to '(string, DBManager.(anonymous))': 'Dapper.SqlMapper.Execute(System.Data.IDbConnection, string, , System.Data.IDbTransaction, int?, System.Data.CommandType?)' and 'Dapper.SqlMapper.Execute(System.Data.IDbConnection, string, , System.Data.IDbTransaction, int?, System.Data.CommandType?)' DBManager.cs

Below is my code, I try to put here everything that I think will be useful to look at but without putting too much.

using System;
using System.Linq;
using Dapper;

public bool Insert(SchedulerHistory record)
{
    int res = -1;

    if (record == null)
        return false;

    try
    {
        //var db = new SQLDatabase();

        string sqlquery = "insert into SchedulerHistory (JobId, NextJob, LastJob, ExecuteOnStart) Values (@JobId, @NextJob, @LastJob, @ExecuteOnStart);";

        using (var conn = new System.Data.SQLite.SQLiteConnection(m_connString))
        {
            conn.Open();
            conn.Execute (sqlquery, new { JobId = record.JobId, NextJob = `record.NextJob, LastJob = record.LastJob, ExecuteOnStart = record.ExecuteOnStart });`

            return (res > 0);
        }
    }
    catch (Exception ex)
    {
        LogWriter.Error(ex);
        return false;
    }
}

Note that the "using Dapper;" is marked as not used by VS2012, and the method its not done, I was adapting from what I have previously done because I thought dapper would be helpful.

Accepted Answer

So what happened was exactly what @KirkWoll said, the dll from my company had dapper's dll inside so i just removed the dapper reference of my project and everything worked fine.



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why