Click here to Skip to main content
15,881,838 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am trying to create an application using WinForms that can be installed by anyone requiring only .NET installed. No pre-requisites like SQL Server. What method do I have to use in order for that to accomplish? Like save data in a XML file ?
Any links, examples, suggestion or direction will be appreciated.
Posted

You could use an SQLCE database - the drivers etc are fully included in the .NET framework, so no additional installation is required.
See SqlCEConnection[^]
It's the same as SQL Server as far as usage goes, except it is single user rather than multi user, and does not support stored procedures or command chaining.
 
Share this answer
 
Comments
nummer31 5-Nov-11 13:17pm    
Thank you sir for your reply
this is the first lead I got in days
So, i create the database in SQL Server normally but make the connection using SqlCEConnection ?
In that case, can I use Visual Studio's Setup and Deployment feature for creating the Installer ?
OriginalGriff 5-Nov-11 13:38pm    
Not quite - start SQL Server Management studio, and when it brings up the "Connect to Server" dialog, use the "Server Type" drop down to choose "SQL Server Compact" and then select "new database" from the "Database file" drop down.
When you have created it all, you can include the DB (which is an .SDF file) in your Setup and Deployment project.
nummer31 5-Nov-11 14:00pm    
Nice! Nice!
Thank you very much sir
I'll give it a try
Even though your solution answers my question
I'll keep the question open
In case, I need to reach you for further questions
I hope that's okay
nummer31 8-Nov-11 17:22pm    
i did exactly what u told me to
then i Published my application and installed it
but the database was not included in the published directory
when there needs to be a connection made to the database from the application
i get an error: 'Unable to load DLL "Sqlceme35.dll" '
Please suggest on this matter
OriginalGriff 9-Nov-11 4:04am    
Did you add the reference to the DLL in your project?
It depends on how much data do you have and how do you structure it. XML is quite good and light weight if you have not too much data. One nearly automatic option is using Data Contract.

See http://msdn.microsoft.com/en-us/library/ms733127.aspx[^].

See also my past solutions:
How can I utilize XML File streamwriter and reader in my form application?[^],
Creating a property files...[^].

That was about XML, but you also can use JSON, see deseralize a json string array[^].

Best and cleanest deployment is so called "x-copy installation": you copy the content of your output directory to a user's computer and it start working without any hassles. For deployment, just zip it. Consider this way first, especially if your application is simple. Your data file will come in your output directory as well, if you put it in the project. Alternatively, embed the file(s) in your assemblt exectutable(s) using .xres resources.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900