How to use SQL data sources SANTOSHI ELLANKI

  • Slides: 20
Download presentation
How to use SQL data sources SANTOSHI ELLANKI PRESENTATION ID #22

How to use SQL data sources SANTOSHI ELLANKI PRESENTATION ID #22

Outline How to create an SQL data source control. How to define connection and

Outline How to create an SQL data source control. How to define connection and save it in web. config file. How to use custom statements and stored procedures.

How to create an SQL data source control To create a SQL data source

How to create an SQL data source control To create a SQL data source control, drag the control item from the data group of the Toolbox onto the form. Then choose configure data source from the control smart tag menu and proceed from their. You can also create a SQL data source using the choose data source command in the smart tag menu of bindable control.

THE STARTING DIALOG BOX OF THE DATASOURCE CONFIGUARATION WIZARD

THE STARTING DIALOG BOX OF THE DATASOURCE CONFIGUARATION WIZARD

HOW TO DEFINE THE CONNECTION The configure data source dialog box asks you to

HOW TO DEFINE THE CONNECTION The configure data source dialog box asks you to identify connection for the database you want to use. If you have previously created a connection for the database, you can select it from drop-down list. To create a new connection, click the new connection button to display the add connection dialog box. Then enter the name of the database server in the server name text box.

For SQL server express, you can use localhostsqlexpress as the server name. After you

For SQL server express, you can use localhostsqlexpress as the server name. After you enter the server name, select the authentication mode you want to use. Then select the database you want to connect to from the drop-down box or enter a database name. To be sure that the connection is configured properly, you can click the test connection button.

THE DIALOG BOX FOR DEFINING A CONNECTION

THE DIALOG BOX FOR DEFINING A CONNECTION

HOW TO SAVE THE CONNECTION STRING IN WEB. CONFIG FILE ASP. NET applications can

HOW TO SAVE THE CONNECTION STRING IN WEB. CONFIG FILE ASP. NET applications can store connection strings in the web. config file. If you choose to save the connection string in the web. config file, the connection string attribute of data source control will include a special code that retrieves connection string from web. config file otherwise it will specify actual connection string.

It is recommended to save the connection in web. config file. Then if the

It is recommended to save the connection in web. config file. Then if the location of the database changes, you can change the connection string in web. config file rather than in each data source that uses the connection.

THE DIALOG BOX FOR SAVING THE CONNECTION STRING IN WEB. CONFIG FILE

THE DIALOG BOX FOR SAVING THE CONNECTION STRING IN WEB. CONFIG FILE

How to configure the select statement To configure the select statement you choose whether

How to configure the select statement To configure the select statement you choose whether you want to use custom SQL statement or specify the columns from the table or view in the database. You can click the ORDER BY button to specify how the records should be stored. You can click the WHERE button to specify the selection criteria

The dialog box for defining the select statement

The dialog box for defining the select statement

HOW TO CREATE A WHERE CLAUSE The add WHERE clause dialog box lets you

HOW TO CREATE A WHERE CLAUSE The add WHERE clause dialog box lets you specify a where clause for select statement. To create a condition, you select the column you want to compare, the operator you want to use for the comparison and the source of the data that you want to use for the comparison. Then you must click Add to add the condition to the list of where clause condition.

THE ADD WHERE CLAUSE DIALOG BOX

THE ADD WHERE CLAUSE DIALOG BOX

The where clause section after a condition has been added

The where clause section after a condition has been added

HOW TO USE CUSTOM STATEMENTS AND STORED PROCEDURES How to select custom statements and

HOW TO USE CUSTOM STATEMENTS AND STORED PROCEDURES How to select custom statements and stored procedures To use custom statements with SQL data source, select the SQL statement option and then enter the statement into text box. You can enter select, update, insert, and delete statements by selecting the appropriate tab. To use stored procedures, select stored procedure option and then select stored procedure you want to use from the drop-down list.

THE DIALOG FOR ENTERING A CUSTOM SELECT STATEMENT

THE DIALOG FOR ENTERING A CUSTOM SELECT STATEMENT

THANK YOU

THANK YOU

QUERIES ?

QUERIES ?