QuotePrefix
StringquotePrefix
= CommandBuilder.QuotePrefix; CommandBuilder.QuotePrefix =quotePrefix
;
Gets or sets the character or characters that are prefixed to column,
table, and other object names. Together with the
QuoteSuffix
property, this permits characters such
as spaces to be used when naming objects. The default value is an
empty string.
The following example sets the QuotePrefix
and
QuoteSuffix
property to allow a SQL Server table
containing spaces to be specified:
SqlCommandBuilder cb = new SqlCommandBuilder(); cb.QuotePrefix = "["; cd.QuoteSuffix = "]";
When the update statements are generated by the
CommandBuilder
, the SQL Server object names within
the updating logic statements are delimited by open and close square
brackets.
Although any valid character can be accommodated by setting the
QuotePrefix
and QuoteSuffix
property, the values of QuotePrefix
and
QuoteSuffix
must be valid delimiters in the data
source server. The characters used in the object name must be valid
for naming objects in the data source server.
The QuotePrefix
property can’t be
changed after the DELETE, INSERT, or UPDATE command has been
generated. Attempting to do so raises an
InvalidOperationException
exception.