Download presentation
Presentation is loading. Please wait.
1
Creating Data Base & Sql Data Source
By huda AlSuwailem
2
First, click on App_Data folder.
3
Then, Right-click and choose Add New Item
Then, Right-click and choose Add New Item. A dialog box will appear, select SQL Database. Type a name for the database.
4
Click on View, and select Server Explorer window
Click on View, and select Server Explorer window. Double-click on your database then all files which are stored in this database will appear. Right-click on Table folder and choose Add New Table.
5
Create the fields you desire and choose their data types
Create the fields you desire and choose their data types. Don’t forget to save your table. For example, create 2 fields “StudentID” and “StudentName”.
6
Add two textboxes to deal with the database.
7
Choose SqlDataSource from the Data section in the Toolbox window
Choose SqlDataSource from the Data section in the Toolbox window. From the smart-tag click on Configure Data Source.
8
Choose the data connection you want to use to connect to the database, then click Next.
9
After that, select the first choice to add your Sql statement.
10
Write the SQL statement to select all table’s fields
Write the SQL statement to select all table’s fields. Click Next then Finish.
11
Click on the InsertQuery from the Properties window
Click on the InsertQuery from the Properties window. Write the insert command.
12
Create the Parameters.
13
After creating them, click ok.
14
Add a button control to your page, change its default text -which is “button”- to “insert”. Double-click the insert button and write the following code:
15
Click on the DeleteQuery from the Properties window
Click on the DeleteQuery from the Properties window. Write the delete command. Create the Parameter(s) you need.
16
Click on the UpdateQuery from the Properties window
Click on the UpdateQuery from the Properties window. Write the update command. Create the Parameter(s) you need.
17
Click on the SelectQuery from the Properties window
Click on the SelectQuery from the Properties window. Write the select command. Create the Parameter(s) you need.
18
These are the codes you write in the buttons (Insert, Delete, Update, Select) :
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.