Skip to content

Dapper and DotConnect are not working #1232

@dramirezgmd

Description

@dramirezgmd

When I try to insert a new row using the Execute command, I get the following error:

column "name" does not exist
   at Devart.Data.PostgreSql.e.f(r A_0)
   at Devart.Data.PostgreSql.r.n()
   at Devart.Data.PostgreSql.PgSqlCommand.InternalPrepare(Boolean implicitPrepare, Int32 startRecord, Int32 maxRecords)
   at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior, Boolean nonQuery)
   at Devart.Common.DbCommandBase.ExecuteDbDataReader(CommandBehavior behavior)
   at Devart.Common.DbCommandBase.ExecuteNonQuery()
   at Dapper.SqlMapper.ExecuteCommand(IDbConnection cnn, CommandDefinition& command, Action`2 paramReader)
   at Dapper.SqlMapper.ExecuteImpl(IDbConnection cnn, CommandDefinition& command)
   at Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable`1 commandTimeout, Nullable`1 commandType)

My object definition is this:

  public class Label
  {
        public string Name { get; set; }
        public string Description { get; set; }
  }

My execute command is this:

string command = @"INSERT INTO label (name, description) VALUES (@name, @description)";

  using (IDbConnection connection = new PgSqlConnection(connectionString))
  {
        connection.Open();
        Label label = new Label
         {
               Name = "DapperTest",
               Description = "test",
         };
        connection.Execute(command, label, commandType: CommandType.Text);
  }

The code above works with Npgsql.

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