Click here to Skip to main content
15,900,907 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I use SQLite with my C# winform project and use only Text as data type for everything latter I convert data using code according to my need I just want to know if data type makes deference on running speed?

What I have tried:

I know nothing about databases.
Posted
Updated 1-Jul-21 2:20am
Comments
PIEBALDconsult 1-Jul-21 9:59am    
Only if performance is important.
You can even use XML as a "database" as long as performance isn't critical.
If you find it "fast enough", then go for it.
But don't expect your boss to be impressed.

Using the correct type in the database has numerous advantages. Aside from not needing to parse the value in your code, which will slow things down, your data will take up less space, and will prevent you from storing invalid values which would later fail to parse.
 
Share this answer
 
Comments
Kelly Herald 2-Jul-21 13:18pm    
I agree. A very good example is never ever store a date or date/time as text in a database. First it takes up more storage in the database. Second a date format in one region will not parse correctly in a different region.
NaseerAhmad007 5-Jul-21 7:06am    
I'll keep in mind thanks.
Always use the appropriate datatype: it takes you a couple of minutes to set up and to insert your values, but it saves you hours (or even days) later when you want to us eteh data.

Since you should always use parameterised queries to access your DB (google for "SQL Injection" to se why) it also helps prompt you to check user input and convert it to the right datatype before it gets near the DB - instead of finding it was garbage three months later when you want to do a total, or print a report for a single month for example.
 
Share this answer
 

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