private static void InsertRow(EquipParam row) { insert.Parameters["@ID"].Value = row.ID; for (var i = 0; i < EquipParam.NumValues; i++) { insert.Parameters["@C" + i].Value = row.Values[i]; } insert.ExecuteNonQuery(); }
public static EquipParam GetById(int modelId) { EquipParam result = null; using (var conn = CacheManager.CreateConnection()) { using (var cmd = conn.CreateCommand()) { cmd.CommandText = "SELECT * FROM EquipParams WHERE ID = @ID"; cmd.Parameters.AddWithValue("@ID", modelId); conn.Open(); using (var reader = cmd.ExecuteReader(CommandBehavior.SingleRow)) { if (reader.Read()) { result = EquipParam.FromDataReader(reader); } } } } return(result); }