none
Checking if a file is corrupted RRS feed

  • Question

  • I developed windows mobile application, i have a case that the database file corrupted. so i want to check programmatically if database file is corrupted ?? how can i do it in c#
    Nora
    Wednesday, March 17, 2010 11:37 AM

Answers

  • 1) How do you define 'corrupted' file ??? It's not a nickname - something standing for this word
    2) Try/catch ??

    :)

    C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off (c) — Bjarne Stroustrup [http://www2.research.att.com/~bs/bs_faq.html#really-say-that]
    • Proposed as answer by Jasper22 Wednesday, March 17, 2010 12:37 PM
    • Marked as answer by Liliane Teng Monday, March 22, 2010 8:54 AM
    Wednesday, March 17, 2010 12:36 PM
  • Hello Nora,
    Welcome to MSDN Forum.
    As Jasper22 said, you need first to define 'corrupted'. The most logical thing is to try to get data from the database, if that succeeds, do you regard it as not corrupted ? Or do you need to iterate over all your data to check this ? The way you do this depends on your definition of 'corrupted'.

    Best regards!
    Liliane Teng
    Please mark the replies as answers if they help and unmark them if they provide no help. Thanks
    • Marked as answer by Liliane Teng Monday, March 22, 2010 8:54 AM
    Thursday, March 18, 2010 5:30 AM

All replies

  • 1) How do you define 'corrupted' file ??? It's not a nickname - something standing for this word
    2) Try/catch ??

    :)

    C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off (c) — Bjarne Stroustrup [http://www2.research.att.com/~bs/bs_faq.html#really-say-that]
    • Proposed as answer by Jasper22 Wednesday, March 17, 2010 12:37 PM
    • Marked as answer by Liliane Teng Monday, March 22, 2010 8:54 AM
    Wednesday, March 17, 2010 12:36 PM
  • Hello Nora,
    Welcome to MSDN Forum.
    As Jasper22 said, you need first to define 'corrupted'. The most logical thing is to try to get data from the database, if that succeeds, do you regard it as not corrupted ? Or do you need to iterate over all your data to check this ? The way you do this depends on your definition of 'corrupted'.

    Best regards!
    Liliane Teng
    Please mark the replies as answers if they help and unmark them if they provide no help. Thanks
    • Marked as answer by Liliane Teng Monday, March 22, 2010 8:54 AM
    Thursday, March 18, 2010 5:30 AM