deadfish
deadfish

Reputation: 12304

How connect c# simple project with sqlite?

How could I connect my simple project in C# with SQLite?
Let's say, I have function in C# sendWords(letters,word)
The aim of function would be find words that will be able to construct word with my letters (able to use wildcards - where * means here could be anything).
Sample: word is do* and my letters are ihnkngz - one of the result would be doing If I place * anywhere there should be also another solution do*g => doing

In SQLite I must load dictionary with words, so here shouldn't be any problem, because I have it.

But the problem is that I'm yellow in using databases :( I really do not know where should I start.


SOLUTION

1 download dlls what you want from http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki

2 add reference from file you downloaded to your project

3 try code (add gridView and change TABLE PATH):

private void Show()
    {
        DataTable dt = new DataTable();

        String insSQL = "select * from TABLE";
        String strConn = @"Data Source=PATH";

        SQLiteConnection conn = new SQLiteConnection(strConn);

        SQLiteDataAdapter da = new SQLiteDataAdapter(insSQL, strConn);
        da.Fill(dt);

        dataGridView1.DataSource = dt.DefaultView;

    }

If it doesn't work, change in project's properities > build > platform > x64/x86 If you want create base try sqlite Administrator http://www.macoratti.net/10/03/c_sqlt1.htm

Upvotes: 0

Views: 923

Answers (1)

Jakub Konecki
Jakub Konecki

Reputation: 46018

http://system.data.sqlite.org/index.html/doc/trunk/www/downloads.wiki

Just add a reference to System.Data.SQLite.dll. That's all.

Upvotes: 1

Related Questions