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#? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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.

28th Nov 2018, 3:37 PM
Jorge Beviláqua
Jorge Beviláqua - avatar
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.
30th Nov 2018, 1:37 PM
John Smith
John Smith - avatar
+ 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
28th Nov 2018, 11:59 PM
John Smith
John Smith - avatar
+ 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
29th Nov 2018, 9:38 PM
sneeze
sneeze - avatar
+ 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 🙏🏻🙏🏻
30th Nov 2018, 2:39 AM
Jorge Beviláqua
Jorge Beviláqua - avatar
+ 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.
30th Nov 2018, 1:40 PM
John Smith
John Smith - avatar
+ 1
Thank you so much, John! I’ll follow those steps in that order!! That was really helpful!! 😃
30th Nov 2018, 1:51 PM
Jorge Beviláqua
Jorge Beviláqua - avatar