1 * SQL Lite Data Provider
4 <li>Exists in namespace and assembly Mono.Data.SqliteClient</li>
6 <li>Created by Vladimir Vukicevic</li>
8 <li><a href"http://www.hwaci.com/sw/sqlite/download.html">SQL Lite</a>
9 binaries exist for Linux and Windows. sqlite.dll on Windows
10 and sqlite.so on Linux.</li>
16 <li>Able to connect, execute commands, and retrieve data...</li>
18 <li>Works in mPhoto by providing access to a SQL Lite database to store images.</li>
24 <li>Create a DataAdapter for SQL Lite named SqliteDataAdapter that can be used to
25 Fill a DataTable in a DataSet</li>
27 <li>Get the method GetSchemaTable() in class SqliteDataReader to return a DataTable
34 <li>Have a working mcs and mono</li>
35 <li>Make sure Mono.Data.SqliteClient.dll was built and is installed
36 in the same place as the mono class libraries.</li>
37 <li>If you do not have <a href"http://www.hwaci.com/sw/sqlite/download.html">SQL Lite</a>,
38 download it. There are binaries for Windows and Linux.</li>
39 <li>There is a test named SqliteTest.cs found at mcs/class/Mono.Data.SqliteTest/Test</li>
40 <li>Has a connection string format of "URI=file:some/path". For example,
41 the connection string "URI=file:SqliteTest.db" will use the database file
42 named SqliteTest.db, if it does not exist, the file will be created.</li>
47 using Mono.Data.SqliteClient;
51 public static void Main(string[] args)
53 string connectionString = "URI=file:SqliteTest.db";
55 dbcon = new MySQLConnection(connectionString);
56 IDbCommand dbcmd = dbcon.CreateCommand();
57 // requires a table to be created named employee
58 // with columns firstname and lastname
60 // CREATE TABLE employee (
61 // firstname varchar(32),
62 // lastname varchar(32));
64 "SELECT firstname, lastname " +
66 dbcmd.ConnectionString = sql;
67 IDataReader reader = dbcmd.ExecuteReader();
68 while(reader.Read()) {
69 string FirstName = reader[0];
70 string LastName = reader[1];
71 Console.WriteLine("Name: " +
72 FirstName + " " + LastName);
85 <li>Building C# Example:
87 <li>Save the example to a file, such as, TestExample.cs</li>
90 mcs TestExample.cs -r System.Data.dll \
91 -r Mono.Data.SqliteClient.dll
94 <li>Build on Windows via Cygwin:
96 mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \
98 -lib:C:/cygwin/home/MyHome/mono/install/lib \
100 -r Mono.Data.SqliteClient.dll
105 <li>Running the Example: