Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6707843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:41:14+00:00 2026-05-26T07:41:14+00:00

Dapper can pass query parameters as anonymous objects, and supports any ADO.NET data provider.

  • 0

Dapper can pass query parameters as anonymous objects, and supports any ADO.NET data provider. However, when running the following query against the Sybase 15 ADO.NET drivers:

using (var connection = new AseConnection("..."))
{
    connection.Open();

    var results = connection.Query<Foo>(
        "dbo.sp_columns", new { table_name = "dbo.sysusers"}, 
        commandType: CommandType.StoredProcedure);
}

… the following error is thrown:

Sybase.Data.AseClient.AseException: Procedure sp_columns expects parameter @table_name, which was not supplied.

at Sybase.Data.AseClient.AseCommand.ᜁ(Int32 A_0)
at Sybase.Data.AseClient.AseCommand.ᜄ()
at Sybase.Data.AseClient.AseCommand.ᜀ(CommandBehavior A_0)
at Sybase.Data.AseClient.AseCommand.System.Data.IDbCommand.ExecuteReader()
at Dapper.SqlMapper.<QueryInternal>d__13`1.MoveNext() in SqlMapper.cs: line 579
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList(IEnumerable`1 source)
at Dapper.SqlMapper.Query(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in SqlMapper.cs: line 536

Changing it to a Dapper DynamicParameters set with “@table_name” also doesn’t work.

How can I pass strongly-typed parameters to Sybase with Dapper?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:41:14+00:00Added an answer on May 26, 2026 at 7:41 am

    As far as I can tell, the reason seems to be something to do with Sybase’s AseParameter class, and not correctly mapping DbType to AseDbType values.

    You can work around the problem by defining a custom Dapper IDynamicParameters set, and populating it with AseParameter objects directly:

    public class AseCommandParameters : List<AseParameter>, SqlMapper.IDynamicParameters
    {
        public void AddParameters(IDbCommand command, SqlMapper.Identity identity)
        {
            foreach (var parameter in this)
                command.Parameters.Add(parameter);
        }
    }
    

    And then passing an instance into the query:

    using (var connection = new AseConnection("..."))
    {
        connection.Open();
    
        var parameters = new AseCommandParameters
        {
            new AseParameter("@table_name", "dbo.sysusers")
        };
    
        var results = connection.Query<Foo>("dbo.sp_columns", parameters, 
            commandType: CommandType.StoredProcedure);
    }
    

    This works, and also lets you specify the AseDbType for each parameter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to use Dapper.NET with stored procs that return multiple result
Can someone please explain what this means (from the Dapper.net website) Limitations and caveats
I am giving the Dapper ORM a try. I am able to query data
Can Dapper batch a set of stored proc calls? I see it supports Multiple
(This code is using Dapper Dot Net in C#) This code works: var command
I've only just started looking at Dapper.net and have just been experimenting with some
I'm using dapper for a mvc3 project at work, and I like it. However,
When using Dapper-dot-net, if your querying to a strongly typed results, and your SQL
I am evaluation dapper but i already running into some problems. I am trying
http://code.google.com/p/dapper-dot-net/source/browse/PerformanceTests.cs Confused, PerformanceTest.Run initializes the list by adding test objects. How does it actually

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.