How to: Connect to an ODBC Database Using the SqlDataSource Control
You can use the SqlDataSource control to connect to any ODBC–compliant data source. You connect the control to an ODBC data source by specifying the appropriate ODBC driver in the connection string along with relevant server and authentication information.
To use the SqlDataSource control to connect to an ODBC database
Open the page from which you want to connect to an ODBC database.
Switch to Design view.
From the Data group on the Toolbox, drag a SqlDataSource control onto the page.
If the smart tag panel is not displayed, right-click the control and then click Show Smart Tag.
In the SqlDataSource Tasks list, click Configure Data Source.
The Configure Data Source wizard is displayed.
In the Configure Data Source dialog box, click New Connection.
If the Add Connection dialog box is displayed, click Change to display the Change Data Source dialog box.
In the Change Data Source dialog box, click Microsoft ODBC Data Source in the Data source list, and then click OK.
The Add Connection dialog box is displayed.
If you have an existing ODBC data source, click Use user or system data source name and select an existing ODBC data source from the list.
If you do not have an existing ODBC data source, click Use connection string and then type the connection string or click Build to display the Select Data Source dialog box where you can build an ODBC data source name (DSN).
If necessary, enter the user name and password required to connect to the database.
Click Test connection to verify the connection to the ODBC data source, and then close the Add Connection dialog box to return to the Configure Data Source wizard.
Click Next, and then click Next again to have the connection string information saved as part of the Web.config file under the name you provide.
In the Configure the Select Statement pane, if you want to use the wizard to create a SQL query, click Specify columns from a table or view and use the options in the pane to configure your query.
To have the wizard generate Insert, Update, and Delete statements based on the Select statement you are creating, click Advanced.
If you want to use the query builder or write your Select query, click Specify a custom SQL statement or stored procedure, click Next, and then write your SQL statement. Click the UPDATE, INSERT, or DELETE tabs to create update statements.
In the Test Query pane, click Test Query to determine whether the query returns the results you want, and then click Finish.