Hi,
Would be great to get some direction re trying to use sqlite for my WinForms application I'm building in VS2008.
Installation - Is it just drop the "System.Data.SQLite.DLL" file into some folder in my VS2008 project (e.g. create a folder for it), and then create a "reference" to it? I've made the property of the reference CopyGlobal = TRUE. Is the idea that when I deploy my application this should work (e.g. deploy the DLL for the application)
Initial Database - Do I have to create an initial database or not? I see the below mentioned code in the Help file but what is the DB it actually connects to and where would the DB file be?
DbProviderFactory fact = DbProviderFactories.GetFactory("System.Data.SQLite"); using (DbConnection cnn = fact.CreateConnection()) { cnn.ConnectionString = "Data Source=test.db3"; cnn.Open(); }
What methods to use - Is this typically how I would use/make calls?
DbProviderFactory fact = DbProviderFactories.GetFactory("System.Data.SQLite"); using (DbConnection myconnection = fact.CreateConnection()) { myconnection.ConnectionString = "Data Source=test.db3"; myconnection.Open(); SQLiteTransaction mytransaction = SQLiteTransaction)myconnection.BeginTransaction(); SQLiteCommand mycommand = new SQLiteCommand((SQLiteConnection)myconnection); mycommand.CommandText = "SELECT * FROM SYSTEM"; mycommand.ExecuteNonQuery(); mytransaction.Commit(); myconnection.Close(); }
How would I setup the database tables? Would I do this and store it in my VS2008 project as a template? Or would I want to automatic the creation of the database in code if it wasn't there?
If the idea from 4 is to setup tables prior, where would I store this initial database file? such that when I run the project to test it and then I use the database file, the one I'm testing with gets scrapped afterwards. I guess I'm asking how to ensure I have a separate blank but configured (with tables) database as "source" in my VS2008 project, but then when I run/debug it, it would take a copy of this for use in testing?
Thanks