Lab 11 Form Handling , connecting with SQL server and insert Objective • • • • Add Controls to Web Form Form Validation Creating databases Connecting ASP site with SQL server and insert Current Lab Learning Outcomes (LLO) By completion of the lab the students should be able to 1. Add Controls to Web Form 2. add Form Validation 3. Creating database 4. Connect ASP site with SQL server Lab Requirements Visual Studio .Net 2012 , Microsoft SQL server 2012 Lab Assessment In lab exercises should be completed and HW Lab Description Implement the use of Controls to Web Form, Form Validation, database and Connect ASP site with SQL server Extra (supplementary) Materials (if any) ❖ Add an empty Web Form 1. Create “New Project” 2. In Solution Explorer, right-click the name of your Web site, and then click AddNew Item. 3. Add an empty Web Form 4. Open the new web form in design view and go to standard toolbox add a label and change its properties (e.g. text, id etc.). 5. Add the text box and change its properties (e.g. ID=ID_TextBox) 6. Add a label and a text box for ID, First name , and Email 7. Select the button and set its properties. ❖ Form Validation 1. From validation toolbox Select the RequiredFieldValidation drag and drop it in ID field 2. Select the range validator and bound it with id text box and set its range from 1 to 20 drag and drop it in ID field ❖ Connecting to Database and insert 1. Open sql sever and create the database and a table with the following field’s ( ID,Firstname, Email ) . 2. In visual studio from data toolbox select the control “SqlDataSource” and click on configure data source. 3. Select data source “Microsoft sql server ) then select your server name , and put your username and password After that you can select your database then you can test the connection. 4. You can select the fields that you want to retrieve from the DB. Select the control “SqlDataSource” and set its properties, go to insert query and write the insert query that will take the input from the text filed and put it in the database add a parameter for the three input id (@id), firstaname (@fname) and email (@email). 5. Double click the Save button and write the following code SqlDataSource1.Insert(); Then run the project 6. Save the project to use in the next class ❖ HW Create a database called school and a table called courses containing the following fields (id , course_name, text_book, duration) Create a web form with the suitable inputs and controllers, connect to database and connect the SqlDataSource to it. Insert the data to the database using the web form.
Form Handling , connecting with SQL server and insert
We offer the best custom writing paper services. We have answered this question before and we can also do it for you.
GET STARTED TODAY AND GET A 20% DISCOUNT coupon code DISC20
We offer the bestcustom writing paper services. We have done this question before, we can also do it for you.
Why Choose Us
- 100% non-plagiarized Papers
- 24/7 /365 Service Available
- Affordable Prices
- Any Paper, Urgency, and Subject
- Will complete your papers in 6 hours
- On-time Delivery
- Money-back and Privacy guarantees
- Unlimited Amendments upon request
- Satisfaction guarantee
How it Works
- Click on the “Place Order” tab at the top menu or “Order Now” icon at the bottom and a new page will appear with an order form to be filled.
- Fill in your paper’s requirements in the "PAPER DETAILS" section.
- Fill in your paper’s academic level, deadline, and the required number of pages from the drop-down menus.
- Click “CREATE ACCOUNT & SIGN IN” to enter your registration details and get an account with us for record-keeping and then, click on “PROCEED TO CHECKOUT” at the bottom of the page.
- From there, the payment sections will show, follow the guided payment process and your order will be available for our writing team to work on it.