0

The process of setting up a database server is far too complicated for my programs needs, not to mention expensive, and I wish to use local files as a stopgap measure until our webapp can be deployed.

I'd ideally like to use three files - one for the item database with the primary key, one for upcoming conditions, and one for archived conditions. Using a text file would be time and memory consuming, however I am intrigued by the usage of XML. Is this something XML can do? Or, should I look at some sort of simple table (consequently, is there a table as such)?

  • I only use local files because of the super small scale in question; for example my primary table has three columns and twelve rows. At the very most, the upcoming conditions table will have around five hundred rows, and the archived conditions table will rarely be accessed.

  • I cannot use an alternative to MS-SQL - it is not supported within my company. This forbids Express, CE, LocalDb etc.

  • I cannot install MS-SQL on the target machines, there is not enough to cover their licenses. We are not allowed to use Express.

pnuts
  • 58,317
  • 11
  • 87
  • 139
Wolfish
  • 960
  • 2
  • 8
  • 34
  • You could use [SQL Server CE](https://en.wikipedia.org/wiki/SQL_Server_Compact) which is free, has no installation requirements other than including two DLLs with your exectuable (size around 500KB total) and is compatible with much of SQL Server. It's very easy to use (I can post a compilable example if you wanted.) – Matthew Watson Sep 09 '15 at 09:16
  • I cannot use an alternative to MS-SQL - it is not supported within my company. – Wolfish Sep 09 '15 at 09:22
  • And what, pray tell, would using XML as a database alternative be, other than an alternative to MS-SQL? – Matthew Watson Sep 09 '15 at 09:23
  • The usage of XML wouldn't (afaik) require the installation of additional software. This is the deciding factor - if Windows does it natively, I can use it. Otherwise, if it isn't on our decidedly short list of supported software, I can't use it. CE would be audited as adding "additional system files" purely because of their format. – Wolfish Sep 09 '15 at 09:31
  • Ok so you should really say "I cannot use any DLLs other than the ones supplied as part of .Net or the Windows API" – Matthew Watson Sep 09 '15 at 09:40

2 Answers2

1

First of all: I'm not sure why you would think XML might be a good alternative if you think a text-file would be too time- and memory-consuming (xml is text based, after all).

Anyway, another option might be to simply create your needed structure (or structures) in C# as one or more objects, and serialize these to a file. For instance, you might create three dictionary-objects to contain the data you mention, then include all of these as members in a data container class.

Now you can serialize an instance of this class to a file. Check for the existence of such a file, or create a new instance if needed next time you run the program.

As long as this is only used within your own application, this aught to work well enough.

Update: Serializing an object basically means that the data contained in a .Net object is converted into a format which can be stored on a drive, for example. You can serialize to various formats - including "plain text", and XML. When an object has been saved this way, you may be able to open the file in a text editor and see and understand the basic structure. You can retrieve and recreate a stored object by deserializing such a file.

Example result from a quick search: Serialize an object to string

Community
  • 1
  • 1
Kjartan
  • 18,591
  • 15
  • 71
  • 96
  • This sounds like the answer I'm looking for. Are serialised objects able to receive new data or edit existing data after they have been created? Or would I have to treat them like strings? – Wolfish Sep 09 '15 at 09:40
0

Its better to use SQLite or LocalDB.

ram hemasri
  • 1,624
  • 11
  • 14