This can be a easy question but I wish to make certain I'm carrying this out the proper way.

What's the best practice for hooking up to some database? This is the way I'm presently doing the work and I wish to make certain this seems following best practice.

private static SQLiteConnection conn;

    public static SQLiteConnection Conn
    {
        get 
        {
            try
            { 
                if (conn == null)
                    conn = new SQLiteConnection(fullName);

                if (conn.State != ConnectionState.Open)
                {
                    conn.ConnectionString = connectionString;
                    conn.Open();
                }
            }
            catch (Exception Excp)
            {
                DataErrorLogger.WriteError(Excp, "");
            }

            return conn;
        }

    }

After I really make use of the connection I'm carrying this out.

 using (SQLiteConnection conn = new SQLiteConnection(SQLiteConn.Conn))
        {}

Thanks!

SQLHelper can easily provide you with good quality ideas, but it's written particularly for MS Sql Server, not SqlLite that you simply seem to be using. Their are a large number of methods to do what you would like, and i believe it greatly is dependent upon the problem.

1) Consider multi-threads. Discover utilizing it, you'll be able to ignore this, but otherwise make sure that each thread is applying its very own connection. You could also need to make certain just one thread can call your SQLiteConnection at any given time. Rather than utilizing a class-level static conn, return a brand new conn every time.

2) Use connection pooling. This helps lessen the overhead of every call obtaining a new connection.

3) Consider caching information that doesn't change (or transformed rarely) but can be used frequently.

4) Try catching more specific exception types to ensure that you are able to take corrective action immediately. May be the user/pass invalid? Could it be a burglar exception? Would you not have access to enough assets?

5) You need to rethrow your error, or throw a replacement in line with the error (innerexception) to ensure that the calling function knows it unsuccessful.

6) Think about using a few of the generic classes that will help you write the above mentioned- it'll make it simpler to change engines or reuse the code to have an alternate engine (Db Classes or IDb connects)

7) You're utilizing a singleton, generally I suggest people prevent them unless of course there is a valid reason. I see lots of misuse of these.

Hopefully this could move you onto your path with what you would like. Otherwise, please return and request for clarification or further help/.