Exemplo n.º 1
0
        public static string UpdateByPrimaryKey(DataTable dataTable)
        {
            var columns   = SqlUpdateHelper.ArrangeColumns(dataTable);
            var tableName = dataTable.TableName;

            return($"UPDATE [{tableName.Trim()}] SET {columns.Trim()} WHERE {SqlPrimaryKeyStringHelper.ArrangeColumnsWithParam(dataTable)};");
        }
Exemplo n.º 2
0
        public static string UpdateByColumn(DataTable dataTable, DataColumn dataColumn)
        {
            var columns   = SqlUpdateHelper.ArrangeColumns(dataTable, dataColumn);
            var tableName = dataTable.TableName;
            var clmName   = dataColumn.ColumnName.Contains(" ") ? $"[{dataColumn.ColumnName}]" : dataColumn.ColumnName;

            return($"UPDATE [{tableName.Trim()}] SET {columns.Trim()} WHERE {clmName}=@{dataColumn.ColumnName.Replace(" ", "")};");
        }