By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,799 Members | 1,376 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,799 IT Pros & Developers. It's quick & easy.

Accessing data without using database (.Net 2005).

P: 79
Is it possible to add, edit, view and delete records using a file only (instead of
a database) and .Net 2005 (VB.Net/C#)?
The concept is that a file that'll work more-or-less like a database. One can add, edit, view, delete and query data to and from the file. The file, either cannot be opened directly or data inside the file should be in some encrypted form so that even if the file is opened no one can comprehend it. Data inside the file can only be manipulated by a front end application i.e. .Net 2005.

If there's some methodology like this then please refer me some links to tutorials
and whitepapers. Thanks in advance.
Jan 31 '10 #1

✓ answered by Curtis Rutland

I would suggest using XML and encryption. Using LINQ to XML you can handle updating, inserting, and deleting very easily.

But I think your best bet would be to use a compact, portable DB. Something like sqlite.

Share this Question
Share on Google+
3 Replies


tlhintoq
Expert 2.5K+
P: 3,525
I suppose one could use a simple text file, but encrypt the lines of data in it.

But to add, edit, view, delete, and query... That's another story.
One would have to have single-use access to the text file.
Adding is a simple file.append
Deleting would mean read it all into memory, remove the one entry, then write it all back out.
Query would mean reading it all in then search for what you want.
Edit would be much like deleting, read it all in, make a change, write it all back out.

Some of that could be avoided if every record were a fixed length. Then you could seek to a given point and write a change. But that deleting still means re-writing the entire file.

So the short answer is 'yes', it could be done. But the reality is that it would quickly become unreasonable if you had more than a simple list of delimited fields. And it is totally impractical if you need more than one person to have simultaneous access.

There are many articles on encryption. Just google for "MSDN Encryption"

http://support.microsoft.com/default.aspx/kb/307010
http://msdn.microsoft.com/en-us/maga...55.aspx?ppud=4
Jan 31 '10 #2

Curtis Rutland
Expert 2.5K+
P: 3,256
I would suggest using XML and encryption. Using LINQ to XML you can handle updating, inserting, and deleting very easily.

But I think your best bet would be to use a compact, portable DB. Something like sqlite.
Feb 2 '10 #3

P: 79
Yeah XML is one of the best options. Most peers suggested this way. Sqlite is also another good option. There are certain scenarios where DBMS like MSSQL or Oracle is too expensive and needs large setup. Portable DB like Sqlite serves the purpose well indeed. Thanks anyway.
Feb 3 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.