Table of Contents

Class DatabaseReplacer

Namespace
Dynamicweb.Data
Assembly
Dynamicweb.Core.dll

This class contains functions to replace specified values in specified fields in a Database.

public class DatabaseReplacer
Inheritance
DatabaseReplacer
Inherited Members

Remarks

DatabaseFunction to call
Do the replaceRunReplace

Properties

Field

Sets or gets the name of the primary key field in the specified table to do the replace on

public string Field { get; set; }

Property Value

string

The name of the primary key field.

Remarks

.

PrimaryKeyField

Sets or gets the name of the field in the specified table to do the replace on

public string PrimaryKeyField { get; set; }

Property Value

string

The name of the field.

PrimaryKeyValue

Sets or gets the value of the primarykey in the specified table to do the replace on

public string PrimaryKeyValue { get; set; }

Property Value

string

The primarykey of the column.

Remarks

If PrimaryKeyValue is specified the replace will only be run on the record matching this value. Otherwise all records in the specified field in the table containing the ReplaceString will be replaced

ReplaceString

Sets or gets the string to replace.

public string ReplaceString { get; set; }

Property Value

string

The string to replace.

Remarks

Cannot be an empty string.

ReplaceWith

Sets or gets the string to replace with.

public string ReplaceWith { get; set; }

Property Value

string

The string to replace with.

Table

Sets or gets the name of table in the specified database to do the replace on.

public string Table { get; set; }

Property Value

string

The name of the table.

Methods

GetDataSet()

Gets a dataset of fields and their values for displaying what will be replaced.

public DataSet? GetDataSet()

Returns

DataSet

DataSet.

Remarks

DataSet is disposed

ReplaceInDatabase(string, string, string, string, string, string)

Executes the replace on the database.

public string ReplaceInDatabase(string database, string table, string field, string primaryKeyField, string originalValue, string replaceValue)

Parameters

database string

Name of database.

table string

Name of table.

field string

Name of field.

primaryKeyField string

Name of primary key field.

originalValue string

String to replace.

replaceValue string

String to replace with.

Returns

string

Message with result of the replace with the number of records affected by replace.

Remarks

database, table, strField and strReplaceString must be specified.

RunReplace()

Executes the replace on the database.

public string RunReplace()

Returns

string

Message with result of the replace with the number of records affected by replace.

Remarks

Database, Table, Field and ReplaceString properties must be specified.

To top