Click here to Skip to main content
15,891,851 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I use C# winform, to import a Excel content to a dataset.
Now I want to hide the Excel file and don't allow user to edit it, is there a method or option to package the file to winform program.

The reason i choose Excel as Database is could edit it directly and easy. Also itn't the only choice, i just need package a small database to winform inside, this is aim to prohibit user to edit even to see it.

How to achieve this?
Posted

1 solution

Any file can be packed directly in the assembly, but as far as I know such files are read-only.

I suggest storing your data in a separate file and use encryption to protect your data from direct reading/writing.
 
Share this answer
 
Comments
Kean(cn) 10-Sep-10 6:42am    
Yes, the Excel file could be package to Setup program, but after setup, the excel would be shown blow setup folder, but i want to the winform program could merge the Excel file, user couldnt see it.
Kubajzz 10-Sep-10 7:25am    
Yes, but if your Excel file is embedded in the assembly, then you won't be able to edit it. As far as I understand you need to be able to edit the Excel file, so embedding is not an option.

If you keep the file separate, encrypt it and change its name, it will be visible to the user, but the contents and the purpose of the file will be hidden and your program will be able to edit it.
Kean(cn) 11-Sep-10 4:18am    
Ok, understood, but I prefer to executable file could merge the data file which only for read.
Kubajzz 11-Sep-10 4:48am    
Oh, that's another story... See this article for some information on embedded files in a WinForms assembly: http://www.codeproject.com/KB/audio-video/PlayWavFiles.aspx
Kean(cn) 12-Sep-10 3:01am    
thank you!

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