locked
Data is "stuck" in development DB, Need help deleting. RRS feed

  • Question

  • I'm using VS Pro 2013.

    I have a query that is getting the wrong count in my development database. In one place, it always shows the count as one, while in other areas based on the same table, no records are seen at all.

    The query is for UncompletedInvoices and is set to show invoices whose completed date is null. It shows that there is one uncompleted invoice, even though all invoices are completed.

    To fix this problem, I went into my app and deleted all invoices in my development database. The count was still showing one, so I went and deleted all related records for all invoices. Now I have an editable grid screen that shows all invoices, and it shows that there are no invoices in the database, yet on another screen, the UncompletedInvoices query count is still showing "one".

    When I try to set something up in code to delete the item found by the query, I get an error saying that another user has deleted this item already, and it gives me the option to delete, but it never actually goes away.

    How can I delete everything in my development DB and start fro scratch? Deleting the bin and obj folders like I could in previous versions gives me errors.

    Wednesday, December 11, 2013 3:02 PM

Answers

  • Deleting the .\bin\data\ folder will cause LightSwitch to create a new database.

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    • Proposed as answer by Xpert360 Wednesday, December 11, 2013 3:57 PM
    • Unproposed as answer by thatITguyfromGA Wednesday, December 11, 2013 5:33 PM
    • Proposed as answer by Xpert360 Wednesday, December 11, 2013 5:43 PM
    • Marked as answer by thatITguyfromGA Wednesday, December 18, 2013 2:13 PM
    Wednesday, December 11, 2013 3:11 PM

All replies

  • Deleting the .\bin\data\ folder will cause LightSwitch to create a new database.

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    • Proposed as answer by Xpert360 Wednesday, December 11, 2013 3:57 PM
    • Unproposed as answer by thatITguyfromGA Wednesday, December 11, 2013 5:33 PM
    • Proposed as answer by Xpert360 Wednesday, December 11, 2013 5:43 PM
    • Marked as answer by thatITguyfromGA Wednesday, December 18, 2013 2:13 PM
    Wednesday, December 11, 2013 3:11 PM
  • Doing that breaks my app. The home screen will load (and still loads with the offending query showing one item) but all of my supporting screens (Customers, Invoices, Orders, etc) get the dreaded red X all over the place.

    This also does not appear to remove any data from my database.


    Wednesday, December 11, 2013 5:32 PM
  • I have cleared databases like that a hundred time over and it worked on 2010/2012 and now 2013. So you have some other problem.Why don't you start with the query with count #1 as that is clearly wrong and sounds like nothing to do with the database data.

    btw you are not running VS2012 and VS2013 projects side by side are you?

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    Wednesday, December 11, 2013 5:46 PM
  • I am only using VS Pro 2013.

    I too have deleted the bin and obj folders to clear data out of previous versions, and it is not working. Upon rebuilding the app, trying to open any data-related screens gives me an error:

    Public ReadOnly Property Customers1 As Global.Microsoft.LightSwitch.Framework.Client.VisualCollection(Of Global.LightSwitchApplication.Customer)
                Get
                    Return __Customers.DetailsClass.GetValue(Me, __Customers.DetailsClass.PropertySetProperties.Customers1)
                End Get
            End Property

    Saying it cannot open the database. "

    The underlying provider failed on Open.

    Inner exception message:

    Cannot open database "9F095DFD914EB70050EAB10D2B177450_OJECTS\RABONTECH MANAGEMENT SYSTEM\RABONTECH MANAGEMENT "

    And even after deleting all of these items, I still get a query that counts 1 no matter what.

    The problem is that the query is still counting 1, despite there being no data there to count. The invoices are set as the "many" in a one to many relationship, and there aren't even any "one's" to have "many" invoices, yet the query count still shows as one. 

    I've deleted the query and rewrote it. Same results. I've deleted all the related data. Same results.

    It's not the end of the world because the problem doesn't appear in the published app. I just hate feeling like something is broken and I can't fix it!

    Wednesday, December 11, 2013 6:03 PM
  • If you look in Data does it contain a new empty database? I am wondering if you have localdb problems.

    Can you share a sample of your query count problem?

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    Wednesday, December 11, 2013 6:11 PM
  • Yes, the replacement DB shows up, but somehow the data from the one I deleted is still there. 

    I'd be more than happy to upload a zip of my project to the cloud and send a link to you. What's your email?

    Wednesday, December 11, 2013 7:02 PM
  • I deleted the database here but it had the problem that Curtis describes.

    I cleaned and rebuilt the process but also checked some of the security roles for debug as there were none (for forms authentication). This got the empty database working.

    The count 1 may be a kipper rouge as an unexpected error message may have been interpreted as a data record due to unauthorised access. We will take a further look at this.

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.


    • Edited by Xpert360 Thursday, December 12, 2013 8:30 AM
    Wednesday, December 11, 2013 7:04 PM
  • Thanks so much Dave! I'll be awaiting your reply.
    Thursday, December 12, 2013 2:30 PM
  • So what is the final verdict, Dave?
    Monday, December 16, 2013 3:45 PM
  • Sorry Curtis,

    Our replies got bounced back from your isp.

    I have not been able to reproduce the phantom count=1 problem. if you can then it may need a http trace to check. I had an OData scenario like this with http 500 errors a while back looking like a record (could have been preview of VS2012 update 3).

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    Monday, December 16, 2013 5:12 PM
  • So when you ran the App, you never saw on the Dashboard screen under invoices:

    "You have 1 invoice(s) awaiting payment"?

    That is the error I'm referring to. I see it every time.

    Setting up security admin and changing the configuration manager to debug did solve the issue with the red X's showing up when I delete the database, however the data still remains, also. I see the above error, as well as other data (On a screen under the Administration menu called Repair Services Grid) that does not get deleted either. 


    Monday, December 16, 2013 8:07 PM
  • Real looking old data sounds like a caching problem but I don't see them (there was some data there before LS recreated the database) and no count=1

    Dave


    Dave Baker | AIDE for LightSwitch | Xpert360 blog | twitter : @xpert360 | Xpert360 website | Opinions are my own. For better forums, remember to mark posts as helpful/answer.

    Monday, December 16, 2013 9:19 PM
  • Okay then. I have no clue how we are able to view the same project from the same location and get different data out of the same database, but as I said before, it's not the end of the world since it only shows up during development.

    I certainly appreciate your time and help with this. I'll mark your original answer as the correct one. Thanks

    Wednesday, December 18, 2013 2:12 PM