CDBException because access file table item have value like "#Error".
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: CDBException because access file table item have value like "#Error".

  1. #1
    Join Date
    Jan 2008
    Location
    India
    Posts
    780

    CDBException because access file table item have value like "#Error".

    Hi all,

    i m using access with odbc connection and use CRecordset class,

    some time the table item have value like "#Error".and if i want to try read this record than exception is generate here.

    please tell me how can i remove this record or tell me anything else to handle this.

    thanks in advance.
    IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH

  2. #2
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,019

    Re: CDBException because access file table item have value like "#Error".

    If a CDBException is thrown, means that something gone wrong either in database or in your code.
    See CDBException::m_nRetCode for possible error sources.
    First of all, you have to handle those exceptions, i.e. try and catch them to see what's going wrong and eventually, take a decision.
    Code:
       try
       {
          // call some functions which can throw CDBException*
          // (methods of CDatabase, CRecordset and related classes).
       }
       catch(CDBException* e)
       { 
          e->ReportError(); // show what's going wrong.
          // ... something else that has to be done in case of error...
          e->Delete();     // delete exception.
       }
    Ovidiu Cucu
    "When in Rome, do as Romans do."
    Visit: Microsoft Virtual Academy
    Follow: https://twitter.com/#!/ovidiucucu
    My blog: http://codexpert.ro/blog/author/ovidiu-cucu/

  3. #3
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,269

    Re: CDBException because access file table item have value like "#Error".

    Quote Originally Posted by vjshankwar View Post
    ... some time the table item have value like "#Error".and if i want to try read this record than exception is generate here.

    please tell me how can i remove this record or tell me anything else to handle this.
    And what is the field type where an item value is like "#Error"?
    Is it your own database or a third party one?
    Usually "#Error" means that something is wrong with a field or table or database design...
    Victor Nijegorodov

  4. #4
    Join Date
    Jan 2008
    Location
    India
    Posts
    780

    Re: CDBException because access file table item have value like "#Error".

    e->ReportError(); gives error message "MFC Internal Error : unable to load error string from resource".

    and the field type is Text and its my own access type database.
    IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH

  5. #5
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,269

    Re: CDBException because access file table item have value like "#Error".

    Check the validation rule for this "Text" field, the texts in this field to have correct characters and length (BTW, what is the max allowed length for this field?)Do these texts UNICODE or ANSI?
    What happens if you open this DB in Access data view: do you see tses "#Error" values somewhere?
    Victor Nijegorodov

  6. #6
    Join Date
    Jan 2008
    Location
    India
    Posts
    780

    Re: CDBException because access file table item have value like "#Error".

    i m not set any max value for field, by default it takes 255 chars.

    when i open the access file and the table has value display like #Error and when i select this row or column access file popup the error message "Not a valid bookmark"

    please help me how can i do this.
    IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH

  7. #7
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,269

    Re: CDBException because access file table item have value like "#Error".

    You must first of all find out the appearance of "#Error" in this Access table!
    Last edited by VictorN; February 7th, 2011 at 04:42 AM.
    Victor Nijegorodov

  8. #8
    Join Date
    Jan 2008
    Location
    India
    Posts
    780

    Re: CDBException because access file table item have value like "#Error".

    Quote Originally Posted by VictorN View Post
    You must firdt of all to find out the appearance of "#Error" in this Access table!
    When I compacted/repaired it I received these errors in a table called MSysCompactError:

    -1206 Could not find field 'Description'
    -1053 Could not find field 'Description'

    in a rep_table

    please help me how can i resolve this and prevent to occur this error.
    IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH

  9. #9
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,269

    Re: CDBException because access file table item have value like "#Error".

    Sorry, I never had (and never saw) those errors.
    Use google search to find out possible ways to solve...
    http://www.pcreview.co.uk/forums/acc...-t1081763.html
    http://bytes.com/topic/access/answer...iring-database
    http://www.google.com/search?sclient...&aqi=&aql=&oq=
    Victor Nijegorodov

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center