public async Task <int> CreateAndRunInsertAsync(object[] values, string table, string fields) { return(await OdbcCommands.CreateInsert(await ConnectAsync(), table, SqlUtility.ToArrayFromCommas(fields), values).ExecuteNonQueryAsync()); }
public static OdbcCommand CreateInsert(OdbcConnection connection, string table, string[] fields, params object[] args) { OdbcCommand comm = new OdbcCommand(string.Format(Insert, table, SqlUtility.AppendWithCommas(fields), SqlUtility.GenerateInsertParameters(fields))); for (int i = 0; i < args.Length; i++) { comm.Parameters.Add(new OdbcParameter() { Value = args[i] }); } comm.Connection = connection; return(comm); }
public async Task <int> UpdateAsync(string Table, string Fields, string Where, params object[] Values) { return(await CreateAndRunUpdateAsync(Table, Where, SqlUtility.ToArrayFromCommas(Fields), Values)); }