System.Data 2.0.0.0 System.Object System.Collections.IDictionary System.ComponentModel.ICustomTypeDescriptor

The class provides the base class from which the strongly typed connection string builders (, , and so on) derive. The connection string builders let developers programmatically create syntactically correct connection strings, and parse and rebuild existing connection strings.

The has been defined in a database-agnostic manner. Because of the addition of the namespace, developers require a base class against which they can program in order to build connection strings that can work against an arbitrary database. Therefore, the class lets users assign arbitrary key/value pairs and pass the resulting connection string to a strongly typed provider. All the data providers that are included as part of the .NET Framework provide a strongly typed class that inherits from : , , , and .

The developer can build, assign, and edit connection strings for any arbitrary provider. For providers that support specific key/value pairs, the connection string builder provides strongly typed properties corresponding to the known pairs. In order to support providers that require the ability to support unknown values, developers can also supply arbitrary key/value pairs.

The class implements the interface. This means that the class works with Visual Studio designers at design time. When developers use the designer to build strongly typed DataSets and strongly typed connections within Visual Studio, the strongly typed connection string builder class will display the properties associated with its type and will also have converters that can map common values for known keys.

Developers needing to create connection strings as part of applications can use the class or one of its strongly typed derivatives to build and modify connection strings. The class also makes it easy to manage connection strings stored in an application configuration file.

Developers can create connection strings using either a strongly typed connection string builder class, or they can use the class. The performs no checks for valid key/value pairs. Therefore, it is possible using this class to create invalid connection strings. The supports only key/value pairs that are supported by SQL Server; trying to add invalid pairs will throw an exception.

Both the method and property handle tries to insert malicious entries. For example, the following code correctly escapes the nested key/value pair:

[Visual Basic]

`Dim builder As New System.Data.Common.DbConnectionStringBuilder builder("Data Source") = "(local)" builder("integrated sSecurity") = True builder("Initial Catalog") = "AdventureWorks;NewValue=Bad"`

[C#]

`System.Data.Common.DbConnectionStringBuilder builder = new System.Data.Common.DbConnectionStringBuilder(); builder["Data Source"] = "(local)"; builder["integrated Security"] = true; builder["Initial Catalog"] = "AdventureWorks;NewValue=Bad";`

The result is the following connection string that handles the invalid value in a safe manner:

`data source=(local);integrated security=True; initial catalog="AdventureWorks;NewValue=Bad"`

Provides a base class for strongly typed connection string builders.

- Constructor
  To be added.

  Initializes a new instance of the class.

  2.0.0.0
- Constructor

  If is true, this uses ODBC rules for quoting values (surrounding values with curly braces ({})). If is false, this uses quotation mark character ("") to delimit values.

  Initializes a new instance of the class, optionally using ODBC rules for quoting values.

  true to use {} to delimit fields; false to use quotation marks.
  2.0.0.0
- Method
  System.Void `` ``

  The property can also be used to add new elements by setting the value of a key that does not exist in the dictionary. For example: myCollection["myNonexistentKey"] = myValue.

  Calling the method by passing a null (Nothing in Visual Basic) key throws an . However, calling the method by passing a null value removes the key/value pair.

  Adds an entry with the specified key and value into the .

  The key to add to the . The value for the specified key. 2.0.0.0
- Method
  System.Void `` `` ``

  This method allows developers using a to create a collection of key/value pairs to be able to take advantage of the features included in the class when you add key/value pairs, without having to incur the overhead of creating and maintaining a instance. The AppendKeyValuePair method formats the key and value correctly and adds the new string to the supplied .

  Provides an efficient and safe way to append a key and value to an existing object.

  The to which to add the key/value pair. The key to be added. The value for the supplied key. 2.0.0.0
- Method
  System.Void `` `` `` ``

  This method allows developers using a to create a collection of key/value pairs to be able to take advantage of the features included in the class when adding key/value pairs, without having to incur the overhead of creating and maintaining a instance. The AppendKeyValuePair method formats the key and value correctly and adds the new string to the supplied .

  Although most data sources let you delimit fields by using quotation marks, ODBC does not--for ODBC connection strings, you must use curly braces ({}). In order to have the use ODBC rules for delimiting fields, set the parameter to true.

  Provides an efficient and safe way to append a key and value to an existing object.

  The to which to add the key/value pair. The key to be added. The value for the supplied key. true to use {} to delimit fields, false to use quotation marks. 2.0.0.0
- Property
  System.ComponentModel.DesignOnly(true)
  System.ComponentModel.Browsable(false)
  System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)
  System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)
  System.Boolean To be added.

  Developers creating designers that take advantage of the class must be able to make the connection string visible or invisible within the designer's property grid. The property lets developers indicate that the property should be invisible by setting the property to false.

  Gets or sets a value that indicates whether the property is visible in Visual Studio designers.

  2.0.0.0
- Method
  System.Void

  The method removes all key/value pairs from the and resets all corresponding properties. This includes setting the property to 0 and the property to an empty string.

  Clears the contents of the instance.

  2.0.0.0
- Method
  2.0.0.0
  System.Void

  This method is used by designers to clear all associated property descriptors on the .

  Clears the collection of objects on the associated .

- Property
  System.ComponentModel.RefreshProperties(System.ComponentModel.RefreshProperties.All)
  System.String To be added.

  This property returns a semicolon-delimited list of key/value pairs stored within the collection maintained by the . Each pair contains the key and value, separated by an equal sign. The following example illustrates a typical connection string.

  `"Persist Security Info=False;Integrated Security=SSPI;Initial Catalog=AdventureWorks;Data Source=(local)"`

  Data providers may expect specific keys and values for each connection string property. , These values are documented individually. The class does not validate the key/value pairs associated with its connection string, although classes that inherit from it can.

  The property of the class acts generally as a mechanism for creating and parsing semicolon-delimited lists of key/value pairs separated with equal signs. It provides no validation or other support specific to connection strings. If you add items to the collection, the property will reflect the changes. If you assign a value to the property, the will try to parse the value, using the semicolon and equal-sign delimiters.

  Gets or sets the connection string associated with the .

  2.0.0.0
- Method
  System.Boolean `` To be added.

  Determines whether the contains a specific key.

  true if the contains an entry with the specified key; otherwise false.

  The key to locate in the . 2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.Int32 To be added. To be added.

  Gets the current number of keys that are contained within the property.

  2.0.0.0
- Method
  System.Boolean ``

  Comparisons on key names are case insensitive; value comparisons are case sensitive.

  The method returns true if the key/value pairs are equal, regardless of their order. The connection behavior of the two connection strings are equivalent, because order is never significant within connection strings. However, different order may affect connection pooling behavior of connections based on these connection strings.

  Compares the connection information in this object with the connection information in the supplied object.

  true if the connection information in both of the objects causes an equivalent connection string; otherwise false.

  The to be compared with this object. 2.0.0.0
- Method
  System.Void `` To be added.

  Fills a supplied with information about all the properties of this .

  The to be filled with information about this . 2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.Boolean To be added.

  A fixed-size collection does not allow adding or removing elements after the collection is created, but it does allow modifying existing elements.

  A fixed-size collection is just a collection with a wrapper that prevents adding and removing elements; therefore, if changes are made to the underlying collection, including adding or removing elements, the fixed-size collection reflects those changes.

  Gets a value that indicates whether the has a fixed size.

  2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.Boolean To be added.

  A read-only collection does not allow adding, removing, or modifying elements after the collection is created.

  A read-only collection is just a collection with a wrapper that prevents modifying the collection; therefore, if changes are made to the underlying collection, the read-only collection reflects those changes.

  Gets a value that indicates whether the is read-only.

  2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.Object `` To be added. To be added. To be added. To be added. 2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.Collections.ICollection To be added.

  The order of the values in the is unspecified, but it is the same order as the associated values in the returned by the property.

  The returned is not a static copy; instead, the refers back to the keys in the original . Therefore, changes to the are reflected in the .

  Gets an that contains the keys in the .

  2.0.0.0
- Method
  System.Boolean ``

  Because the method returns a value that indicates its success, it is not required to look for the key before trying to remove the key/value pair from the instance.

  Removes the entry with the specified key from the instance.

  true if the key existed within the connection string and was removed; false if the key did not exist.

  The key of the key/value pair to be removed from the connection string in this . 2.0.0.0
- Method
  System.Boolean ``

  This method behaves identically to the method.

  Indicates whether the specified key exists in this instance.

  true if the contains an entry with the specified key; otherwise false.

  The key to locate in the . 2.0.0.0
- Method
  2.0.0.0
  System.Void `` ``

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For a description of this member, see .

  Copies the elements of the to an , starting at a particular index.

  The one-dimensional that is the destination of the elements copied from . The must have zero-based indexing. The zero-based index in at which copying begins.
- Property
  2.0.0.0
  System.Boolean To be added.

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For more information, see .

  Gets a value indicating whether access to the is synchronized (thread safe).

- Property
  2.0.0.0
  System.Object To be added.

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For more information, see .

  Gets an object that can be used to synchronize access to the .

- Method
  2.0.0.0
  System.Void `` ``

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For a description of this member, see .

  Adds an element with the provided key and value to the object.

  The to use as the key of the element to add. The to use as the value of the element to add.
- Method
  2.0.0.0
  System.Boolean ``

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For more information, see .

  Determines whether the object contains an element with the specified key.

  true if the contains an element with the key; otherwise, false.

  The key to locate in the object.
- Method
  2.0.0.0
  System.Collections.IDictionaryEnumerator

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For a description of this member, see .

  Returns an object for the object.

  An object for the object.

- Property
  2.0.0.0
  System.Object `` To be added. To be added. To be added. To be added.
- Method
  2.0.0.0
  System.Void ``

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For a description of this member, see .

  Removes the element with the specified key from the object.

  The key of the element to remove.
- Method
  2.0.0.0
  System.Collections.IEnumerator

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For a description of this member, see .

  Returns an enumerator that iterates through a collection.

  An object that can be used to iterate through the collection.

- Method
  2.0.0.0
  System.ComponentModel.AttributeCollection

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For a description of this member, see .

  Returns a collection of custom attributes for this instance of a component.

  An containing the attributes for this object.

- Method
  2.0.0.0
  System.String

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For a description of this member, see .

  Returns the class name of this instance of a component.

  The class name of the object, or null if the class does not have a name.

- Method
  2.0.0.0
  System.String

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For more information, see .

  Returns the name of this instance of a component.

  The name of the object, or null if the object does not have a name.

- Method
  2.0.0.0
  System.ComponentModel.TypeConverter

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For a description of this member, see .

  Returns a type converter for this instance of a component.

  A that is the converter for this object, or null if there is no for this object.

- Method
  2.0.0.0
  System.ComponentModel.EventDescriptor

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For a description of this member, see .

  Returns the default event for this instance of a component.

  An that represents the default event for this object, or null if this object does not have events.

- Method
  2.0.0.0
  System.ComponentModel.PropertyDescriptor

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For a description of this member, see .

  Returns the default property for this instance of a component.

  A that represents the default property for this object, or null if this object does not have properties.

- Method
  2.0.0.0
  System.Object ``

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For more information, see .

  Returns an editor of the specified type for this instance of a component.

  An of the specified type that is the editor for this object, or null if the editor cannot be found.

  A that represents the editor for this object.
- Method
  2.0.0.0
  System.ComponentModel.EventDescriptorCollection

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For more information, see .

  Returns the events for this instance of a component.

  An that represents the events for this component instance.

- Method
  2.0.0.0
  System.ComponentModel.EventDescriptorCollection ``

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For more information, see .

  Returns the events for this instance of a component using the specified attribute array as a filter.

  An that represents the filtered events for this component instance.

  An array of type that is used as a filter.
- Method
  2.0.0.0
  System.ComponentModel.PropertyDescriptorCollection

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For more information, see .

  Returns the properties for this instance of a component.

  A that represents the properties for this component instance.

- Method
  2.0.0.0
  System.ComponentModel.PropertyDescriptorCollection ``

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For more information, see .

  Returns the properties for this instance of a component using the attribute array as a filter.

  A that represents the filtered properties for this component instance.

  An array of type that is used as a filter.
- Method
  2.0.0.0
  System.Object ``

  This member is an explicit interface member implementation. It can be used only when the instance is cast to an interface.

  For more information, see .

  Returns an object that contains the property described by the specified property descriptor.

  An that represents the owner of the specified property.

  A that represents the property whose owner is to be found.
- Method
  System.String To be added.

  Returns the connection string associated with this .

  The current property.

  2.0.0.0
- Method
  System.Boolean `` `` To be added. To be added. To be added. To be added. To be added. 2.0.0.0
- Property
  System.ComponentModel.Browsable(false)
  System.Collections.ICollection To be added.

  The order of the values in the is unspecified, but it is the same order as the associated keys in the returned by the method.

  The returned is not a static copy; instead, the refers back to the values in the original . Therefore, changes to the are reflected in the .

  Gets an that contains the values in the .

  2.0.0.0