Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm fairly new to C#, and one of my assignments is to create a script that converts SQLite database files into CSV files and then combine the CSV files. How would I even go about this? Any starting help would be greatly appreciated.

What I have tried:

- Turning the SQLite databases into lists but I'm not sure how to count the number of columns in SQLite so I'm not sure how many columns to make
- I've tried using
PRAGMA table_info(table_name);

to find how many columns exist inside of a SQLite Database, however PRAGMA just seems to give me another table in return. I've tried using
SELECT COUNT(*) from PRAGMA table_info(table_name)

to get a numerical output but it just ends up giving me an error.
Posted
Updated 17-Sep-20 23:48pm
v2

This is an answer to your question but it's also a warning of sorts that here on CP it's customary to provide code with your question and typically, your understanding of what's going wrong with that code. IE compiler warnings, verbose messages, etc.

DB Browser for SQLite[^]

That said I'm posting this SQLite database browser address where a free tool can be downloaded so that you can identify the number of columns in said databases. Again, show code and you'll get code.
 
Share this answer
 
Comments
stevenlam505 17-Sep-20 14:23pm    
Ah I see thank you. I've updated my question and added a bit of code of that I've tried to figure out how many columns are inside of a table (PRAGMA), but I'm not sure how to actually turn that into a numerical value. I've tried using SELECT COUNT(*) FROM PRAGMA table_info(table_name) however that only results in an error.
You first need to understand something about SQLite: https://www.sqlite.org/index.html[^]. But you can also use the command line tool sqlite3 to get information about the database.
 
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