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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Attempt to open a table failed......

Attempt to open a table failed......

Scheduled Pinned Locked Moved C / C++ / MFC
databasehelp
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
    vijay victory
    wrote on last edited by
    #1

    Hi Experts, I have created an Database application using CDatabase and CRecordset. Following is some part of code where the Exception occurs....

    CRecordset UserRs(&UserCn);
    .
    .
    Sql="Select * from UserInfo";
    //Exception occured here
    UserRs.Open(CRecordset::snapshot,Sql,CRecordset::none);

    The Exception is : "Attempt to open a table failed-there were no columns to retrieve were specified.." I m confused..Becoz the same code run on my machine doesnt work on others machine. and the query also correct. plz Help me.. Waitng for ur Reply..

    I have never failed,I just found 1000 ways that never works. Regards, Victory.

    M 1 Reply Last reply
    0
    • V vijay victory

      Hi Experts, I have created an Database application using CDatabase and CRecordset. Following is some part of code where the Exception occurs....

      CRecordset UserRs(&UserCn);
      .
      .
      Sql="Select * from UserInfo";
      //Exception occured here
      UserRs.Open(CRecordset::snapshot,Sql,CRecordset::none);

      The Exception is : "Attempt to open a table failed-there were no columns to retrieve were specified.." I m confused..Becoz the same code run on my machine doesnt work on others machine. and the query also correct. plz Help me.. Waitng for ur Reply..

      I have never failed,I just found 1000 ways that never works. Regards, Victory.

      M Offline
      M Offline
      Mike the Red
      wrote on last edited by
      #2

      Assuming that there is a table in your DB called UserInfo, I would check that the CDatabase object is connected to the datasource using UserCn.IsOpen before trying to open the RS. Check that the datasource is configured the same on the target machine as it is on yours - including permissions. In my experience, that is the most common source of this type of problem... though I admit my needs have never occasioned use of C++ for database connectivity. MZR

      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