+ 3
Which of these two (System.IO or MySQL)is the easiest way to store and retrieve data from tables in a Desktop Application in C#?
Im planning on build a desktop application that gets data that the user input in certain fields, then performs some computation with those values, then store them in tables accordingly. I was wondering if I should use the System.IO methods to store and retrieve that data (which I actually donât know if it works well for tables) or if I should go with an MySQL external database, which seems more complex but I guess itâs easier to manage data on tables. I wonât be handling much data. Any thoughts on that? Any alternative built-in ideas? Thanks in advance.
6 Answers
+ 1
@Jorge BevilĂĄqua Not quite. So, SQL Server allows you to host your database (among a wealth of other things) TSQL is the language used to query the database, but you still need a means to talk to the actual database server via C# - ADO.NET provides that functionality. ADO Provides you a means to connect to the database along with executing queries, and reading results. Its pretty straight forward.
I suggest you find a course on SQL Server/TSQL/ADO.NET you'll find a lot on Entity framework, but I'd suggest avoiding that until you have a solid understanding of the above.
+ 3
If you used IO you'd only end up attempting to replicate the functionality of a database. I'd suggest you learn SQL Server / T-SQL and consume it via ADO.NET then move onto Entity Framework.
Maybe start here:
https://www.youtube.com/watch?v=GVV-LUcmCOE
+ 2
It really depends on the enviroment you can create.
Do you want to use a database or rather have a application without.
For databases you can use sqlconnection and sqlcommand
https://www.dotnetperls.com/sqlconnection
For small amount of data you can use files https://www.dotnetperls.com/file
You can System.IO. Using a streamreader and comma separated files (or choose any separator you want).
https://www.dotnetperls.com/file
Database :
You need to install the database
Files :
Users can find the files and read or change them or delete them
+ 1
John Smith and sneeze, thank you so much for your thoughts. They mean a lot to me đ.
That was an interesting argument. If I were to use System.IO, at some point I would be probably ending up trying to replicate the same functionalities from a database.
Just another question, Jhon. What do you mean by consuming it via ADO.NET? You mean keeping the sql database online on the web?
That would be great about the uptime, but I would be needing to keep backups and keep them up to date very often, right?
Thanks a lot đđ»đđ»
+ 1
Also as @sneeze DBS aren't always the correct way forward it depends on the data you're storing, but by the sounds of your original post you wish to store structured data in a table format, so a DB would be better suited.
Not to mention its a valuable skill to have, so either way I'd suggest you learn about the above.
+ 1
Thank you so much, John! Iâll follow those steps in that order!!
That was really helpful!! đ