protected override void RunSqlScript(StringReader reader) { Console.Out.WriteLine("connectionString = {0}", connectionString); using (SqliteConnection conn = new SqliteConnection(connectionString)) { conn.Open(); SqliteTransaction tran = (SqliteTransaction) conn.BeginTransaction(IsolationLevel.Serializable); try { string line; StringBuilder cmd = new StringBuilder(); while ((line = reader.ReadLine()) != null) { if (line.Trim().ToLower() == "go") { ExecuteNonQuery(cmd.ToString(), (IDbConnection) conn, (IDbTransaction) tran); cmd.Length = 0; } else { cmd.Append(line); cmd.Append(Environment.NewLine); } } if (cmd.ToString().Trim().Length > 0) { ExecuteNonQuery(cmd.ToString(), conn, tran); } tran.Commit(); } catch (Exception) { tran.Rollback(); } finally { if (conn.State != ConnectionState.Closed) { conn.Close(); } } } }