Class DatabaseReplacer
- Namespace
- Dynamicweb.Data
- Assembly
- Dynamicweb.Core.dll
This class contains functions to replace specified values in specified fields in a Database.
- Inheritance
-
Database
Replacer
- Inherited Members
Remarks
Database | Function to call |
---|---|
Do the replace | RunReplace |
Properties
Field
Sets or gets the name of the primary key field in the specified table to do the replace on
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
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
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.
Property Value
- string
The string to replace.
Remarks
Cannot be an empty string.
ReplaceWith
Sets or gets the string to replace with.
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.
Property Value
- string
The name of the table.
Methods
GetDataSet()
Gets a dataset of fields and their values for displaying what will be replaced.
Returns
- Data
Set 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
stringName of database.
table
stringName of table.
field
stringName of field.
primaryKeyField
stringName of primary key field.
originalValue
stringString to replace.
replaceValue
stringString 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.
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.