I am attempting to write an experimental client type application using C# and the app will require a small to medium sized database. I only need a local database so am thinking SQLite will suite my needs better than say, MySQL.
The problem is this. I have moderate experience programming in C# but little experience with databases. Putting a C# app and a database together is proving very difficult for me as I have never done it before.
I have experimented with sqlite3.exe in the command line and that's straight forward enough.
I have run through the following tutorials but I am lost and I don't really understand them: -
http://www.mikedunca...tnet-in-3-mins/
http://brennydoogles...te-with-csharp/
I know in theory what I want to do but I have no idea how to do it.
I'm not sure how to attack this. Can someone with some experience give me some pointers?
Thank you.
Learning to use SQLite with C#
Page 1 of 12 Replies - 3917 Views - Last Post: 12 December 2011 - 02:55 PM
Topic Sponsor:
Replies To: Learning to use SQLite with C#
#2
Re: Learning to use SQLite with C#
Posted 02 October 2011 - 09:52 AM
Quote
I know in theory what I want to do but I have no idea how to do it.
Well - what do you want to do? I am bad at guessing games for intent of programs.
Your basic concept is you:
read data from the database with SELECT statements.
insert new rows into the database with INSERT
modify rows with UPDATE
remove rows with DELETE
The gist to read data is:
write your SQL statement as a string.
create a connection to your database
open said connection.
create a sqlcommand object from the sql string and the connection
execute the sqlcommand object and have it fill a sql adapter or datareader.
close the connection to the database
parse through your sqladapter or datareader for your rows.
the insert/update/delete follow the same route but instead of using a sqldata adapter you use the sqlcommand object's "execute non reader" or some similar method.
Also wrap everything in a try/catch.
#3
Re: Learning to use SQLite with C#
Posted 12 December 2011 - 02:55 PM
What kind of issue are you having? The second link you posted is from my blog, so if there is any part of my tutorial I could clarify for you I would be more than happy to!
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote







|