Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>SQLHelper can certainly give you some good ideas, but it is written specifically for MS Sql Server, not SqlLite which you appear to be using. Their are dozens of ways to do what you want, and I think it very much depends upon the situation.</p> <p>1) Take into account multi-threading. If you aren't using it, then you can ignore this, but otherwise make certain that each thread is using its own connection. You might also want to make certain only one thread can call your SQLiteConnection at a time. Instead of using a class-level static conn, return a new conn each time.</p> <p>2) Use connection pooling. This will help reduce the overhead of each call getting a new connection.</p> <p>3) Consider caching information that does not change (or changed infrequently) but is used frequently. </p> <p>4) Try catching some more specific exception types so that you can take corrective action immediately. Is the user/pass invalid? Is it a security exception? Do you not have enough resources?</p> <p>5) You should rethrow your error, or throw a new one based on the error (innerexception) so that the calling function knows it failed.</p> <p>6) Consider using some of the generic classes to help you write the above- it will make it easier to switch engines or reuse the code for an alternate engine (Db Classes or IDb interfaces)</p> <p>7) You are using a singleton, generally I recommend people avoid them unless they have a good reason. I see a lot of misuse of them.</p> <p>Hopefully this can move you onto the right path with what you want. If not, please come back and ask for clarification or further help/.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload