Exforsys.com
 
Home Tutorials ASP.NET 2.0
 

ASP.NET 2.0 Free Tutorials : SqlDataSource Control

 

ASP.NET 2.0 Free Tutorials : SqlDataSource Control - Page 2

Page 2 of 2



On clicking continue the user is prompted to select an existing data source or to click change to change the data source or provider. The user has to also enter the name of the new database or an existing data base. Name the new database as ExForSys and click Test Connection.



If the connection is successful the user gets a message to the effect that he has been successfully connected. The connection is then displayed in the Configure data Source box.



The next string prompts the user to save the connection string to the application configuration file. The user has to click on the check box if ‘yes’ and then click Next.



The next screen prompts the configuration of the Select Statement. Now the user has to specify a custom SQL statement or stored procedure or specify columns from a table or view. Click Next to continue.



The next screen requires the user to define custom statements or stored procedure. The screen helps the user create commands for each operation that has to be supported in the database such as select, update, insert or delete.



For instance a select statement can be entered by the user as shown in the screen as under or the help of the query builder can be taken to create the SQL statement.



The query can be tested and the results of the query will be displayed in the preview screen of the wizard. Once the preview is complete the user can click finish to complete the process of configuring the database.



The user is now taken back to the DataSource configuration wizard screen that requires him to select the data field to display in the drop down list and within that a data field for the value of the drop down list. Once the user has selected the required data, he has to click OK to continue.



The user is now taken back to the Design view of the Visual Studio IDE with the control displaying that it is DataBound and that the data source is SqlDataSource with the SqlDataSource1. A number of new options have been added to the DropDownList Task menu.




ASP.NET 2.0 offers a codeless way of incorporating data into a web application. The data source controls can be declaratively and automatically instantiated and IDataSource and IHierarchicalDataSource can be used to allow data sources and data controls to work together efficiently. The consistent model of data representation enables developers to control data access and is also consistent with the old methods of accessing data. The data also has become accessible across a variety of sources while the page developer can use the same model of data access irrespective of the data source he is accessing. In the next lesson we shall explore in greater detail some of the data bound controls that take advantage of codeless binding.




First Page: ASP.NET 2.0 Free Tutorials : SqlDataSource Control


Read Next: ASP.NET 2.0 Training : Data Bound Controls



 

 

Comments


Jun said:

  please provide more detail on usage of the sqlDataSource.
for example if i am using the SqlDataSource.Select([noarg]) how do i retrieve the recordset. how do i check if an empty set was returned.
not for gridview but rather display on a page.
December 13, 2006, 7:24 am

Post Your Comment:

Members Please Login
Your Name:*
e-mail ID:(required for notification)*
Image Verification: 
 
 Subscribe    

Sponsored Links

 

Subscribe via RSS


Get Daily Updates via Subscribe to Exforsys Free Training via email


Get Latest Free Training Updates delivered directly to your Inbox...

Enter your email address:


 

Subscribe to Exforsys Free Training via RSS
 

 
Partners -  Privacy and Legal Policy -  Site News -  Contact   Sitemap  

Copyright © 2000 - 2009 exforsys.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape