SqlDataSource Members

The data source that allows you to bind Windows Forms data-aware controls to a database (in read-only mode) using specified data connection options.

Constructors

Name Description
SqlDataSource(DataConnectionParametersBase) Initializes a new instance of the SqlDataSource class with the specified connection parameters.
SqlDataSource(String) Initializes a new instance of the SqlDataSource class with the specified connection name.

Fields

Name Description
KeepConnectionOpen static Obsolete. Use the ConnectionOptions.CloseConnection property instead.

Properties

Name Description
AllowCustomSqlQueries static Specifies whether or not custom SQL queries can be used to fill the SqlDataSource.
CanRaiseEvents protected Gets a value indicating whether the component can raise an event. Inherited from Component.
Connection Provides access to the data connection settings of the SqlDataSource.
ConnectionName Specifies the name of a data connection in the App.config file.
ConnectionOptions Provides access to the data connection options of the SqlDataSource.
ConnectionParameters Specifies the data connection settings of the SqlDataSource.
Container Gets the IContainer that contains the Component. Inherited from Component.
DBSchema Gets the schema of the connected SQL data source.
DesignMode protected Gets a value that indicates whether the Component is currently in design mode. Inherited from Component.
DisableCustomQueryValidation static Gets or sets whether the validation of custom SQL queries is performed.
Events protected Gets the list of event handlers that are attached to this Component. Inherited from Component.
Queries Provides access to the collection of queries defined for the SqlDataSource.
Relations Provides access to the collection of master-detail relations of the SqlDataSource.
Result Gets a collection of tables and their relations from the current SqlDataSource.
Site Gets or sets the ISite of the Component. Inherited from Component.

Methods

Name Description
ClearRows() Clears all data cached when filling the SqlDataSource, preserving the information about the original structure of tables, columns and data relations.
CreateObjRef(Type) Creates an object that contains all the relevant information required to generate a proxy used to communicate with a remote object. Inherited from MarshalByRefObject.
Dispose() Releases all resources used by the Component. Inherited from Component.
Equals(Object) Determines whether the specified object is equal to the current object. Inherited from Object.
Equals(Object, Object) static Determines whether the specified object instances are considered equal. Inherited from Object.
Fill() Validates and executes all valid queries available in the SqlDataSource.Queries collection.
Fill(IEnumerable<IParameter>) Validates and executes all valid queries available in the SqlDataSource.Queries collection with the specified parameters.
Fill(IEnumerable<IParameter>, String[]) Validates and executes the specified queries with the required parameters.
Fill(String[]) Validates and executes the specified queries.
FillAsync() Populates the SqlDataSource in an asynchronous manner.
FillAsync(IEnumerable<IParameter>) Populates the SqlDataSource in an asynchronous manner and passes external parameters to the data source.
FillAsync(IEnumerable<IParameter>, String[]) Populates the SqlDataSource in an asynchronous manner and passes external parameters to the data source. You can specify which queries to execute in order to populate the data source.
FillAsync(IEnumerable<IParameter>, String[], CancellationToken) Populates the SqlDataSource in an asynchronous manner, passes external parameters to the data source, and uses the cancellationToken parameter to send the cancellation signal. You can specify which queries to execute in order to populate the data source.
FillAsync(IEnumerable<IParameter>, CancellationToken) Populates the SqlDataSource in an asynchronous manner, passes external parameters to the data source, and uses the cancellationToken parameter to send the cancellation signal.
FillAsync(String[]) Populates the SqlDataSource in an asynchronous manner. You can specify which queries to execute in order to populate the data source.
FillAsync(String[], CancellationToken) Populates the SqlDataSource in an asynchronous manner and uses the cancellationToken parameter to send the cancellation signal. You can specify which queries to execute in order to populate the data source.
FillAsync(CancellationToken) Populates the SqlDataSource in an asynchronous manner and uses the cancellationToken parameter to send the cancellation signal.
GetHashCode() Serves as the default hash function. Inherited from Object.
GetLifetimeService() Retrieves the current lifetime service object that controls the lifetime policy for this instance. Inherited from MarshalByRefObject.
GetType() Gets the Type of the current instance. Inherited from Object.
InitializeLifetimeService() Obtains a lifetime service object to control the lifetime policy for this instance. Inherited from MarshalByRefObject.
LoadFromXml(XElement) Loads the SQL data source schema definition from XML.
MemberwiseClone() protected Creates a shallow copy of the current Object. Inherited from Object.
MemberwiseClone(Boolean) protected Creates a shallow copy of the current MarshalByRefObject object. Inherited from MarshalByRefObject.
RebuildResultSchema() Validates and updates the result schema available on the client after query execution (it can be accessed using the SqlDataSource.Result property). This command does not affect the actual database schema on the server.
RebuildResultSchema(IEnumerable<IParameter>) Validates and updates the result schema available on the client after query execution with the specified parameters (the result schema can be accessed using the SqlDataSource.Result property). This command does not affect the actual database schema on the server.
RebuildResultSchema(Predicate<IEnumerable<SqlQuery>>) Validates and updates the result schema available on the client after confirming the execution of associated queries (the result schema can be accessed using the SqlDataSource.Result property). This command does not affect the actual database schema on the server.
RebuildResultSchema(Predicate<IEnumerable<SqlQuery>>, IEnumerable<IParameter>) Validates and updates the result schema available on the client with the specified parameters after confirming the execution of associated queries (the result schema can be accessed using the SqlDataSource.Result property). This command does not affect the actual database schema on the server.
RebuildResultSchema(Predicate<IEnumerable<SqlQuery>>, IEnumerable<IParameter>, IEnumerable<SqlQuery>) Validates and updates the result schema available on the client with the specified queries and parameters after confirming the execution of associated queries (the result schema can be accessed using the SqlDataSource.Result property). This command does not affect the actual database schema on the server.
ReferenceEquals(Object, Object) static Determines whether the specified Object instances are the same instance. Inherited from Object.
SaveToXml() Saves the XML definition of the SQL data source schema.
ToString() Returns a String containing the name of the Component, if any. This method should not be overridden. Inherited from Component.

Events

Name Description
ConfigureDataConnection Allows you to customize connection settings before connecting to a database.
ConnectionError Fires after an attempt to establish a data connection has failed.
CustomizeFilterExpression Allows you to include WHERE clauses in SQL queries.
Disposed Occurs when the component is disposed by a call to the Dispose() method. Inherited from Component.
ValidateCustomSqlQuery Provides the capability to check the validity of the custom SQL query used to supply the data source with data.
ValidateCustomSqlQueryGlobal static Provides the capability to check the validity of the custom SQL query used to supply SQL data sources with data.
See Also