[ Team LiB ] |
30.2 Properties Reference
Gets or sets the DataAdapter for which the SQL statements are automatically generated. ExampleThe following example sets the DataAdapter property for a newly created CommandBuilder object: SqlDataAdapter da = new SqlDataAdapter(sqlSelect, connString); SqlCommandBuilder cb = new SqlCommandBuilder(); cb.DataAdapter = da; NotesThe DataAdapter property can be set for the CommandBuilder object in the constructor, as shown in this example: SqlDataAdapter da = new SqlDataAdapter(sqlSelect, connString); SqlCommandBuilder cb = new SqlCommandBuilder(da); When a new CommandBuilder is associated with a DataAdapter, any commands from a previous associated CommandBuilder object are released.
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. ExampleThe 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. NotesAlthough 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.
Gets or sets the character or characters that are appended to column, table, and other object names. Together with the QuotePrefix property, this permits characters such as spaces to be used when naming objects. The default value is an empty string. ExampleSee the Example for the QuotePrefix in this chapter. NotesAlthough 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 QuoteSuffix property can't be changed after the DELETE, INSERT, or UPDATE command has been generated. Attempting to do so raises an InvalidOperationException exception. |
[ Team LiB ] |