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

  • SEARCH
  • Home
  • 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 8355473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:52:21+00:00 2026-06-09T09:52:21+00:00

I have a very similar question to Dapper-dot-net "no column name" , but the

  • 0

I have a very similar question to Dapper-dot-net "no column name", but the answer there is not getting me where I need.

I’m writing a web interface and using dapper to get data from Stored Procedures from my client’s ERP system. The SP returns 4 columns of data without column names. That being said the SP’s are locked and I can’t change them.
I’ve tried to work around this by using a temp table in my query as Sam suggested.

var grid = QueryMultiple(@"set nocount on 
declare @t table(Id int, Name nvarchar(max), AnotherId int)

insert @t
exec proc

set nocount off 
select Id, Name from @t
select Id, AnotherId from @t
");

However, I’ve now discovered the original SP also contains an insert for logging and therefore SQL will not allow me to insert my sp into a temp table because of this.

There is mention of adding support for:

class Foo { [ColumnNumber(1)] public string Name {get;set;} }

How can I do this? Can someone point me in the right direction to modify Dapper source to not require column names and allow me to map by column number?

  • 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-06-09T09:52:23+00:00Added an answer on June 9, 2026 at 9:52 am

    The issue of non-trivial bindings keeps coming up; it came up most recently here: http://code.google.com/p/dapper-dot-net/issues/detail?id=108

    My suggestion there stands, although I haven’t had time to code it yet. I propose a static event that you can choose to handle, and apply whatever esoteric mappings you want, i.e.

    SqlMapper.ColumnBind += (sender, args) {
        int colIndex = args.ColumnIndex;
        Type type = args.TargetType;
        MemberInfo member = // ... Entirely up to you to define logic
        args.Member = member;
    };
    

    The above is entirely theoretical, but would it meet your needs?

    Note: if ColumnBind was not subscribed, it would just do normal basic name mapping as normal. Thoughts?

    (note: it could also be a single event invoke per type, rather than per-column; that might be more efficient, as the subscriber will call GetProperties etc less often)

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

Sidebar

Related Questions

I have a question very similar to this one but the answer does not
I have tried my best to understand a very similar StackOverflow question , but
I have a VERY similar question to this question: ASP.NET MVC C# dynamic radiobuttons
I found a very similar question to mine, but not exactly the same. This
A very similar question, but not exact to those asked frequently; my project has
I've asked a very similar question before, but this time is not about VB
I have a very similar question to this question , but I am still
Note that I posed a very similar question earlier but the requirements have since
I know that this is a repeated question. I have found very similar questions
I know that similar questions have been asked before, but I am very much

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.