Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. why my datareader object of oledb in C# not properly reading

why my datareader object of oledb in C# not properly reading

Scheduled Pinned Locked Moved C#
databasecsharphelp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kalaveer
    wrote on last edited by
    #1

    i am trying to read a memo field of database using oledb datareader after executing the query like below datareader.GetValue(0).ToString() which only reading the first 255 chars in the memo field how could i read the whole contents at a time please help.

    E 2 Replies Last reply
    0
    • K kalaveer

      i am trying to read a memo field of database using oledb datareader after executing the query like below datareader.GetValue(0).ToString() which only reading the first 255 chars in the memo field how could i read the whole contents at a time please help.

      E Offline
      E Offline
      ednrgc
      wrote on last edited by
      #2

      What database are you using that has Memo fields?

      L 1 Reply Last reply
      0
      • E ednrgc

        What database are you using that has Memo fields?

        L Offline
        L Offline
        lost in transition
        wrote on last edited by
        #3

        Sounds like MS Access. If at first you don't succed give up go play XBox:laugh: Try something other than a datareader. Try a datatable or if you are only intrested in on field use a SQL statement and run a OleDbCommand.ExecuteScalar();

        Programmer: A biological machine designed to convert caffeine into code. * Developer: A person who develops working systems by writing and using software. [^]

        1 Reply Last reply
        0
        • K kalaveer

          i am trying to read a memo field of database using oledb datareader after executing the query like below datareader.GetValue(0).ToString() which only reading the first 255 chars in the memo field how could i read the whole contents at a time please help.

          E Offline
          E Offline
          ednrgc
          wrote on last edited by
          #4

          Try something like this: dr.Read(); FieldLen = dr[MemoCol].Length; char[] MemoBuffer = new char[FieldLen]; int startIndex = 0; retVal = dr.GetChars(1, startIndex, MemoBuffer, 0, MemoBuffer.Length); Console.WriteLine(MemoBuffer);

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups