tags:

views:

58

answers:

2

Hi everyone

I have installed SQLite and am using the wrapper from: http://sqlite.phxsoftware.com/

I have created my database and table in the server explorer in VS2010 but when I create the connection, I don't understand what to do from there and how to get it to work.

Can someone provide code examples on how to connect to a db, get a table, insert data into the table and select data from a table and output it.

I would really appreciate it.

Thanks

A: 

OK here is what I did (assuming that you have that s**t installed):

1.-right click on server explorer

2.-then click on add conection

3.-on data source click Change then select sqlite

4.-fill out da details

5.-you are done... you can now add datasets....

Luiscencio
I've already tried that, it didn't work out for me.
Sandeep Bansal
@Sandeep Bansal: updated answer
Luiscencio
A: 

Server Explorer is overkill, SQLite is meant to be simple and light. Just use plain code as follows.

SQLiteConnection connection = new SQLiteConnection("Data source=PATH_TO_YOUR_DB;Version=3");
connection.Open();
SQLiteCommand command = connection.CreateCommand();
command.CommandText = "insert into something values (1,2,3)";
command.ExecuteNonQuery();
connection.Close();

Hope it helps.

Jaya Wijaya
Thanks that did help, but if I replace your example table name "something" with e.g. "Config" and I do have 3 columns. it says the table doesn't exist, am I missing something here?
Sandeep Bansal
Sorted it out, all I did was in server explorer was to point it to the created data source and use that.Thanks.
Sandeep Bansal