private void DoSelectCommand(string commandtext, SQLVarsVals Variables) { CommandPerformed = commandtext; SQLPerformed = commandtext; try { SqliteConnection db = sqlcon.GetConnection(); using (SqliteCommand command = db.CreateCommand()) { command.CommandText = commandtext; List <SqliteParameter> Params = GetCommandParameters(Variables); if (Params.Count > 0) { foreach (var p in Params) { command.Parameters.Add(p); } } dread = command.ExecuteReader(); } Success = true; } catch { Success = false; } }
/// <summary> /// Creates the Parameter list to be added to a query /// </summary> /// <returns></returns> private List <SqliteParameter> GetCommandParameters(SQLVarsVals Variables) { List <SqliteParameter> param = new List <SqliteParameter>(); for (int index = 0; index < Variables.Count(); index++) { param.Add(new SqliteParameter("@" + Variables.GetName(index), Variables.GetValue(index))); } return(param); }
public SQLiteUpdate(SQLiteConnection sqlcon, string TableName, SQLVarsVals Fields, SQLWhereVars WhereFields) { SQLUpdateTable table = new SQLUpdateTable(TableName, Fields, WhereFields); DoUpdateCommand(sqlcon, table); }
public SQLiteInsert(SQLiteConnection sqlcon, string TableName, SQLVarsVals Fields) { SQLInsertTable table = new SQLInsertTable(TableName, Fields); DoInsertCommand(sqlcon, table); }