1 / 20

Tutorial -3

Tutorial -3. ADO.NET. Things to do in Tutorial 4. Registering the server and connection to our database Creating a table Sample Application which demonstrates, populating data from database and inserting data into database Populating data into ListBox, GridView, Tables.

Download Presentation

Tutorial -3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Tutorial -3 ADO.NET

  2. Things to do in Tutorial 4 • Registering the server and connection to our database • Creating a table • Sample Application which demonstrates, populating data from database and inserting data into database • Populating data into ListBox, GridView, Tables

  3. Getting started with “SQL Server “ - 1 • Open Microsoft SQL Server -> Enterprise Manager • Select SQL Server Group, right click on it, and select “New SQL Server Registration”

  4. SQL Server Registration - 1 • Click “Next”, and then select the SQL Server with name as “KC-ISSRV-SQL1.KC.UMKC.EDU”, click on Add button and then Next button

  5. SQL Server Registration - 2 • Use default selected options and click on “Next”

  6. SQL Server Registration - 3 • Click on “Finish” and then “Close”. Your server is now registered

  7. Running the SQL Server • Click on KCSQL5, and then click on “Yes” option from the below shown prompt. Select “Databases” and search for “cs551-1” database

  8. Creating a Table • To create a table, right click on Tables, and select New Table as below, and design your table as follows:

  9. Sample Application • We will create a simple application where we can retrieve data from a table, and display in different controls and also insert data into a table. • The basic example will be of using ListBox, getting data into listbox, selecting some data form the listbox to another listbox and then inserting selected data into database • Code samples to populate data from database into different controls such as “GridView” and “Dynamic Tables” are also included.

  10. Create a new “Web Site”, and design your web form as shown below. Controls used in the web form are ListBox, GridView, Table, Literal, Buttons

  11. Adding data to listbox from database • Double click on the web form, and add the code in the next slide under Page_Load function. • Also add the namespaces using System.Data.SqlClient and using System.Data.OleDb. • string connectString = "User ID=cs551fs06-group1; PWD=$Free$pace;Initial Catalog= cs551fs06-group1;Data Source=kc-issrv-sql1.kc.umkc.edu";

  12. Double Click on “Get data into list” and add the below code. Also add the namespaces using System.Data.SqlClient; and using System.Data.OleDb; Use the ones given in the code file

  13. Double Click on “>>” button and add the below code. Double Click on “<<” button and add the below code.

  14. Double Click on “Insert” button and add the below code.

  15. Save, Debug and Run

  16. Double Click on “Get data into GridView” button and add the below code.

  17. Double Click on “Get data into Table” button and add the below code.

  18. Continuation..

More Related