/// <Summary>
/// Execute the statement
/// </Summary>
/// <Param name = "dbpath"> </param>
/// <Param name = "SQL"> </param>
Static void execsql (string dbpath, string SQL)
{
Execsql (dbpath, SQL, null );
}
/// <Summary>
/// Execute the statement
/// </Summary>
/// <Param name = "dbpath"> </param>
/// <Param name = "SQL"> </param>
/// <Param name = "prams"> </param>
Static void execsql (string dbpath, string SQL, sqliteparameter [] prams)
{
Using (sqliteconnection conn = new sqliteconnection ("Data Source =" + dbpath ))
{
Conn. open ();
Using (sqlitecommand cmd = new sqlitecommand (SQL, Conn ))
{
If (prams! = NULL)
{
Foreach (sqliteparameter parameter in prams)
{
Cmd. Parameters. Add (parameter );
}
}
Cmd. executenonquery ();
Cmd. Dispose ();
}
Conn. Close ();
Conn. Dispose ();
}
}
/// <Summary>
/// Execute the query
/// </Summary>
/// <Param name = "dbpath"> </param>
/// <Param name = "SQL"> </param>
/// <Param name = "FN"> </param>
Static void readsql (string dbpath, string SQL, Action <sqlitedatareader> FN)
{
Readsql (dbpath, SQL, FN, null );
}
/// <Summary>
/// Execute the query
/// </Summary>
/// <Param name = "dbpath"> </param>
/// <Param name = "SQL"> </param>
/// <Param name = "FN"> </param>
/// <Param name = "prams"> </param>
Static void readsql (string dbpath, string SQL, Action <sqlitedatareader> FN, sqliteparameter [] prams)
{
Using (sqliteconnection conn = new sqliteconnection ("Data Source =" + dbpath ))
{
Conn. open ();
Using (sqlitecommand cmd = new sqlitecommand (SQL, Conn ))
{
If (prams! = NULL)
{
Foreach (sqliteparameter parameter in prams)
{
Cmd. Parameters. Add (parameter );
}
}
Using (sqlitedatareader rs = cmd. executereader ())
{
While (Rs. Read ())
{
FN (RS );
}
Rs. Close ();
Rs. Dispose ();
}
Cmd. Dispose ();
}
Conn. Close ();
Conn. Dispose ();
}
}