Form Handling , connecting with SQL server and insert
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.
Collepals.com Plagiarism Free Papers
Are you looking for custom essay writing service or even dissertation writing services? Just request for our write my paper service, and we'll match you with the best essay writer in your subject! With an exceptional team of professional academic experts in a wide range of subjects, we can guarantee you an unrivaled quality of custom-written papers.
Get ZERO PLAGIARISM, HUMAN WRITTEN ESSAYS
Why Hire Collepals.com writers to do your paper?
Quality- We are experienced and have access to ample research materials.
We write plagiarism Free Content
Confidential- We never share or sell your personal information to third parties.
Support-Chat with us today! We are always waiting to answer all your questions.