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. Database & SysAdmin
  3. Database
  4. No data found, but HasRows

No data found, but HasRows

Scheduled Pinned Locked Moved Database
databasehelpquestion
2 Posts 2 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.
  • V Offline
    V Offline
    Vector7
    wrote on last edited by
    #1

    I have a problem here while excecute a oledb datareader... ... rdr.close(); //First request closed cmd.CommandText = "SELECT MID FROM MandantMC"; rdr = cmd.ExecuteReader(); if(rdr.HasRows) { strDir = rdr.GetString(0); ... rdr has rows but responsed with this message: System.InvalidOperationException: No data for row/column I don't understand this. The SQL Query analyzer give me correct results, but not this app. Before I started the Excecution of this datareader, I have closed one before ( you can see the first code line ). First request works. After closing it, the second ( the new ExcecuteReader ) fails. Maybe "cmd" make problems ?

    L 1 Reply Last reply
    0
    • V Vector7

      I have a problem here while excecute a oledb datareader... ... rdr.close(); //First request closed cmd.CommandText = "SELECT MID FROM MandantMC"; rdr = cmd.ExecuteReader(); if(rdr.HasRows) { strDir = rdr.GetString(0); ... rdr has rows but responsed with this message: System.InvalidOperationException: No data for row/column I don't understand this. The SQL Query analyzer give me correct results, but not this app. Before I started the Excecution of this datareader, I have closed one before ( you can see the first code line ). First request works. After closing it, the second ( the new ExcecuteReader ) fails. Maybe "cmd" make problems ?

      L Offline
      L Offline
      lokin1
      wrote on last edited by
      #2

      After the ExecuteReader() do a rdr.Read().. it will fix your problem. First record does not get read automatically.

      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