Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Fredrik Esseen 594 posts 830 karma points
    Dec 14, 2010 @ 14:26
    Fredrik Esseen
    0

    Get Single record with IRecordsReader

    Probably a simple question but how do I get a single record with IRecordsReader?

  • Lee Kelleher 3945 posts 15163 karma points MVP 10x admin c-trib
    Dec 14, 2010 @ 18:54
    Lee Kelleher
    0

    Hi froad,

    Do you have an example snippet of code - to give more context of what you are trying to achieve?

    You should be able to call .Read() on the IRecordsReader (or implemented object rather) - then call GetValue (or whatever relevant "Get" method) on the first row.

    Cheers, Lee.

  • Aaron Powell 1708 posts 3044 karma points c-trib
    Dec 14, 2010 @ 23:01
    Aaron Powell
    1

    Yes it's possible, but I strongly suggest you go with a real ORM like LINQ to SQL, Entity Framework 4, NHibernate, etc.

  • Fredrik Esseen 594 posts 830 karma points
    Dec 15, 2010 @ 08:34
    Fredrik Esseen
    0

    As usual I was too fast asking on this forum :)

    I didnt think I could use the simple Read() but so was the case:

    if

     

    (reader.HasRecords)

    {

    reader.Read();

    Label.Text = reader.GetInt(

    "Count").ToString();

    }

    I really have to start looking at LINQ! Just have to find the time..

    Thx for your time :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies