* SQL Lite Data Provider
using System;
using System.Data;
using Mono.Data.SqliteClient;
public class Test
{
public static void Main(string[] args)
{
string connectionString = "URI=file:SqliteTest.db";
IDbConnection dbcon;
dbcon = new SqliteConnection(connectionString);
dbcon.Open();
IDbCommand dbcmd = dbcon.CreateCommand();
// requires a table to be created named employee
// with columns firstname and lastname
// such as,
// CREATE TABLE employee (
// firstname varchar(32),
// lastname varchar(32));
string sql =
"SELECT firstname, lastname " +
"FROM employee";
dbcmd.CommandText = sql;
IDataReader reader = dbcmd.ExecuteReader();
while(reader.Read()) {
string FirstName = (string) reader[0];
string LastName = (string) reader[1];
Console.WriteLine("Name: " +
FirstName + " " + LastName);
}
// clean up
reader.Close();
reader = null;
dbcmd.Dispose();
dbcmd = null;
dbcon.Close();
dbcon = null;
}
}
mcs TestExample.cs -r System.Data.dll \ -r Mono.Data.SqliteClient.dll
mono C:/cygwin/home/MyHome/mono/install/bin/mcs.exe \ TestExample.cs \ -lib:C:/cygwin/home/MyHome/mono/install/lib \ -r System.Data.dll \ -r Mono.Data.SqliteClient.dll
mono TestExample.exe