Suddenly missing records in database

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 1035 Views - Last Post: 05 April 2012 - 11:13 PM Rate Topic: -----

#1 plejer_adam  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 90
  • Joined: 17-May 10

Suddenly missing records in database

Posted 05 April 2012 - 02:17 PM

Hi to everyone.

I am facing a problem, i have developed a little application and at this moment i have problem that i automatically
lose data in database :S

It goes like this, i dont know why is this happening, when and what is causing that.

It's first time something like that happened to me..

So i was wondering did anyone had that problem ?

I am working in VS2012, SQL Server 2008 R2, C#, Entity Framework 4

Is This A Good Question/Topic? 0
  • +

Replies To: Suddenly missing records in database

#2 CowboyCoder  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 24-March 12

Re: Suddenly missing records in database

Posted 05 April 2012 - 02:32 PM

What code are you executing against the database? It doesn't just disappear on its own...
Was This Post Helpful? 0
  • +
  • -

#3 plejer_adam  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 90
  • Joined: 17-May 10

Re: Suddenly missing records in database

Posted 05 April 2012 - 02:46 PM

the problem is that i dont know what is happening !!

i am using and inserting , and updating and deleting !

I wish i can tell you more :(

i am so confused
Was This Post Helpful? 0
  • +
  • -

#4 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1253
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: Suddenly missing records in database

Posted 05 April 2012 - 03:00 PM

You should post any relevant code that actually interacts with the database. Be it, Insert, Delete or Update bits.

If you're using Entity Framework Code First (if you don't know what this is, you aren't using it don't worry), there is an option that you can choose that recreated your entire database schema every time you run the application.

I haven't used it personally, but this might be the cause of your issue.

Until you post code, we can only guess.
Was This Post Helpful? 0
  • +
  • -

#5 plejer_adam  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 90
  • Joined: 17-May 10

Re: Suddenly missing records in database

Posted 05 April 2012 - 03:10 PM

can you tell me how to check if i'm using code first ?

my friend, the biggest problem is, i dont know what i should post to you !

because code is big, and i am debugging it everytime... and everything is fine

but one time i stop debuging i get that thing -.-

i assume its something with framework, but not sure!

can you tell how to check that Framewwork Code First
Was This Post Helpful? 0
  • +
  • -

#6 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1253
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: Suddenly missing records in database

Posted 05 April 2012 - 03:17 PM

If you developed a small application how can you not know at what place in your code you are actually interacting with the backend? This doesn't make sense.

Is this a project you inherited at work from another developer?

If so, use breakpoint from the constructor on the Form (assuming this is Windows Forms). Press F11 for as long as it takes and find out what the flow of the application really is.
Was This Post Helpful? 0
  • +
  • -

#7 plejer_adam  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 90
  • Joined: 17-May 10

Re: Suddenly missing records in database

Posted 05 April 2012 - 03:37 PM

you dont get it..

i developed that app, and i know every line in that code..

but the problem is, when i work in it,sometimes everything is fine, and sometimes happens that i dont know what .. and causes that problem, some datas just disappear

if you are willing to test it, i will send you solution and database :D

now i am testing it, and everything is fine, who knows when will something happen again
Was This Post Helpful? 0
  • +
  • -

#8 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 584
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: Suddenly missing records in database

Posted 05 April 2012 - 03:42 PM

That's the only way this bug can be solved!
If there aren't compile errors but the program sometimes screws up its probably due to either unhandled input, sudden loss of connection or all sorts of things. Without code, we're blind leading the blind (as pbl would say).
Was This Post Helpful? 0
  • +
  • -

#9 plejer_adam  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 90
  • Joined: 17-May 10

Re: Suddenly missing records in database

Posted 05 April 2012 - 03:45 PM

View PostDimitriV, on 05 April 2012 - 03:42 PM, said:

That's the only way this bug can be solved!
If there aren't compile errors but the program sometimes screws up its probably due to either unhandled input, sudden loss of connection or all sorts of things. Without code, we're blind leading the blind (as pbl would say).



i get it, but the only way i can help you solve my problem is to give you my solution and test with me xD

because its freaking me out...

i am still testing it, and everything is fine -.- aaaaa
Was This Post Helpful? 0
  • +
  • -

#10 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 584
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: Suddenly missing records in database

Posted 05 April 2012 - 03:47 PM

If you can't reproduce the error more than 2 times out of 10 then it probably isn't that much of the issue.
Was This Post Helpful? 0
  • +
  • -

#11 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1253
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: Suddenly missing records in database

Posted 05 April 2012 - 03:59 PM

View PostDimitriV, on 05 April 2012 - 06:47 PM, said:

If you can't reproduce the error more than 2 times out of 10 then it probably isn't that much of the issue.


I remember the engineers who worked on the Challenger shuttle said the same thing. ;)

This post has been edited by Sergio Tapia: 05 April 2012 - 03:59 PM

Was This Post Helpful? 0
  • +
  • -

#12 plejer_adam  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 90
  • Joined: 17-May 10

Re: Suddenly missing records in database

Posted 05 April 2012 - 04:02 PM

heheh ooo it is big deal , i lose every record for an article !

so far happened twice !

and i cant let that happen ...
Was This Post Helpful? 0
  • +
  • -

#13 DimitriV  Icon User is offline

  • They don't think it be like it is, but it do
  • member icon

Reputation: 584
  • View blog
  • Posts: 2,738
  • Joined: 24-July 11

Re: Suddenly missing records in database

Posted 05 April 2012 - 04:03 PM

Then it is an issue. You've reproduced it multiple times. Does it happen under any specific conditions?
Was This Post Helpful? 0
  • +
  • -

#14 sela007  Icon User is offline

  • D.I.C Addict

Reputation: 138
  • View blog
  • Posts: 840
  • Joined: 21-December 11

Re: Suddenly missing records in database

Posted 05 April 2012 - 04:12 PM

I was having the similar problem until I do this: Right click on your database >> PROPERTIES >> COPY TO OUTPUT DIRECTORY >> set 'COPY IF NEVER'.
Do same for dataset.
Was This Post Helpful? 1
  • +
  • -

#15 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1253
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: Suddenly missing records in database

Posted 05 April 2012 - 04:26 PM

Hm... you're right that is a common issue when the database is a single file. I haven't used this in many years, but I remember it added a .mdf file to your solution right?

If you're rebuilding your application, that might be whats causing the database file to recreate itself.

This post has been edited by Sergio Tapia: 05 April 2012 - 04:26 PM

Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2