Good day to you all, am currently working on a windows application. I used sql compact edition for the database. But the first problem i got was that it kept giving me errors i copied and pasted to error code on google and I got an article that says I should change the cpu type from "Any CPU" to x86. That solved the error thingy. But each time I added things to the DB, closing and re-opening the app, or probably editing the DB schema always result to lost of all records. If I add a new record, I will be able to percieve it in the DB through the select query I had written in the app. But when I tried to check it through the server explorer, i wont see anything. Please help me on that.

Another thing is that I wish to use a MDI form for the main window and have other windows as the parent so that the app will always run as a single app and appear like that at the status bar. I don't want all the forms i opened while running the app to take a place on this status bar. I have done it before in VB6.0 but i don't know the way out on Visual Studio 2008. Please help. Thanks.

What tool are you using to interact with the database file? If you are using something like the entity framework, data gets cached in memory, but doesn't get written out to disk until you explicetly tell it to. Your app could still see it since it's in the cache.

As far as MDI goes, I believe support is disappearing for it. If you are dead set on using it, you can change the Form.IsMdiContainer to true (take a look here).

If you just want to get rid of the taskbar button for your child windows, set the Form.ShowInTaskbar to false, see here.

Btw, I'm assuming you're using WinForms, since that's what I see on these forums, for the most part, and you didn't specify. If you're using WPF, let me know.

Thanks for your response Sir, I used dataset to connect with the database. But what i noticed is that there are different folders for x86 and x64 in my output folder. Each folder consists of a copy of the database. I always lose all records in the DB after making any changes to the DB. I set the "copy to output Directory" property of the DB to "Copy if newer", I guess that's basically what causes the lost of records each time i edited the DB. I need a solution to that please. As for the MDI Child, I still don't get it. I want to assign children to parent form. Thanks

Oh ok, I got you. Generally when you are using a database, settings or custom file during development, you are not concerned with the changes that occur during runtime. Switch it back to "Copy always". Reason being, if you make changes to the source file (the one directly in your project folder) the copy your application is using will get overriden. So, you'll want your application to work off of the original copy instead. You could do this using preprocessor directives, like this:

#ifdef DEBUG
    string filename = "c:\\...\\mydb.sdf";
#else
    string filename = "mydb.sdf";
#endif

What this does, is uses the db file from a different location, only during the Debug run. So you can statically set the absolute path, or the relative path to use (I believe it's DEBUG all in caps, but it could be Debug).

As for MDI, I want to be sure you understand what MDI is. When you are using MDI, the MDI parent displays nothing (expect a MenuBar) usually. It then contains several child windows. The child windows, cannot move outside the bounds of the parent window (well it can, but it gets clipped). This is how Office 2003 worked, in the sense that you could have multiple windows opened within a parent windows (although a button in the taskbar did appear for each opened document). If you were not using MDI, it would be like opening a settings window, or an open file dialog.

In either case, you just need to set the ShowInTaskbar property to false. Just note, there are some bugs I've come across with MDI, that (according to forum posts back a few years) it doesn't look like Microsoft is looking into resolving. I am seeing less and less applications these days that use MDI on the Windows platform, so it seems to be a dying technology. I could be wrong, I just don't use it, and haven't seen much use of it recently.

Let me know if I need to clarify further.

I really appreciate your responses. But the challenge is that. Which section of the code will i put such instruction. As for the MDI, I will like to rest my case. Other challenges are; How to reload Content of a Datagrid to reflect new changes. Note: I connected the Datagrid to the DB with the Databinding wizard while I write code to update and insert myself simply because I want to use a customizable form for the Input and Editing. The form is different from the one that holds the datagrid. I want all new records i added throught the second form to be reflected on the "Output Form" immediately I close the "Input Form".

I also need a guidline on how to integrate Dynamic Reports. Dynamic in the sense that, I want to have a drop down menu that contains something like "Sale Report", "Order Report" etc. The printable report that will be displayed will change whenever the value of the Combo List changes. Thanks. If you don't mind, I will like to connect you on Skype, facebook, and yahoo chat.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.