DOC PREVIEW
SF State ISYS 546 - Introduction to ADO.Net, VB.Net Database Tools and Data Binding

This preview shows page 1-2-3-19-20-38-39-40 out of 40 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 40 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Introduction to ADO.Net, VB.Net Database Tools and Data BindingSteps to Retrieve DataA Simplified View of ADO.Net ObjectsADO.NET ObjectsData ProvidersUsing ODBCVB.NET Database ToolsCreating SQL Server DatabaseHow to create an ADO.Net object?Data BindingCreating Data Bound FormSlide 12Items Added to the FormOther Data Form DemosCreating A Database Application Without ProgrammingData Adapter WizardCreating Bound DataGridViewObjects Related to Data BindingBinding Text BoxMoveNext and MoveLast ExampleBindingSource ObjectBindingSource’s Position PropertyCurrencyManagerBindingNavigator ObjectBinding ListBoxDisplay Selected RecordListBox SelectedItem PropertyAn Easy Away to Create a Form with Listbox and TextboxesUsing Object BrowserCollection StructureDataSet Class HierarchySlide 32Navigate and Display Records in Unbound Text BoxesImplement MoveNext Button with Unbound ControlUsing Object Browser to Study OleDB ObjectUse the Find method of Table’s Rows collection to find a recordCode ExampleHow to Determine If Record Exists or NotSend Changes in a Bound DataGrid Back to the DatabaseHow to create a dataset with two tables and relation?Introduction to ADO.Net, VB.Net Database Tools and Data BindingISYS546Steps to Retrieve Data •Establishes a connection to the database.•Executes commands against the database.•Store data results.A Simplified View of ADO.Net ObjectsAdo.NetData ProviderConnectionAdapterCommandReaderDatasetData ConsumerWinFormWebFormADO.NET Objects•Connection Object: Represent a connection to the database. •Command Object: The command object allows us to execute a SQL statement or a stored procedure.•DataReader: It is a read-only and forward-only pointer into a table to retrieve records.•DataSet Object: A DataSet object can hold several tables and relationships between tables.•DataAdapter: This the object used to pass data between the database and the dataset.Data Providers•ODBC Provider–Open Database Connectivity•A driver manager•Used for relational databases•OLE DB Provider–OLE DB interfaces provide applications with uniform access to data stored in diverse information sources, or data stores. –Access•SQL Server Provider•Oracle ProviderUsing ODBC•Windows XP: •Control Panel /Administrative Tools/DataSource(ODBC)•Three types of data source names–User DSN: usable only by you and only on the machine currently using.–System DSN: Any one using the machine can use.–File DSN: Can be copied and used by other computers with the same driver installed.VB.NET Database Tools•Database connection:–Tools/Connect to database•Data Source•Server Explorer–Data connections: Right click data connection•Add Connection–Tables, Views•Create new SQL Server Database•Toolbox:Data tab•Data/Add New Data SourceCreating SQL Server Database•From Server Explorer, right click data connection and choose:•Create new SQL Server Database•Server name: –LocalServerName\SQLExpress•Add new table: Right click Tables and choose Add New Table•Add rows: Right click the table name and choose Show table data.How to create an ADO.Net object?•Automatically generated when creating data bound form.–Form wizard•Using Data Adapter Wizard•Using code: –Example:–dim strConn as string ="Provider=Microsoft.Jet.OLEDB.4.0;Data Source = c:\sales2k.mdb"–dim objConn as new OledbConnection(strConn)–objConn.open()Data Binding•Connect a control or property to one or more data elements.•Simple binding: Use simple binding to display a field value in controls that show Data Bindings in the property window, such as text box or label.•Complex binding: Use complex binding to bind more than one field to controls such as DataGrid and list box. Use the control’s Data Source and Data Member to bind the data.Creating Data Bound Form•Creating a form with ADO.Net objects and data-bound controls to display and update information in a dataset.•Demo: –Add data source.–Click the dropdown list next to the table’s name:•Datagrid view•Details–Drag the table to form.Items Added to the Form•Connection•Table Adapter: click smart tag–Add query–Preview data•Dataset:–Edit in dataset designer•Binding Source–Add query: Add a new tool strip.–Preview data•Binding navigator•Code view: Form load event–Me.CUSTOMERTableAdapter.Fill(Me.Sales2KDataSet.CUSTOMER)Other Data Form Demos•DataGrid View•Add /Modify/Delete records.•Read only form: –Delete AddNew, Delete, Save buttons from navigator bar.•Hierarchical forms:–Dataset has Tables collection and Relations collection.•Parent/Child relation–Drag the parent table and the child table to the form. Parent table uses detail view and child table uses dataGrid view–Change dataGrid’s DataSource property to the relation.Creating A Database Application Without Programming•Creating a database application to display information and update database.•A main form with buttons to open data forms:–DisplayInfo–Enter New–Modify–ExitData Adapter Wizard•Configure Data Adapter and generating a dataset:–From the Data tab of the ToolBox, Drag OledbDataAdapter to the form.–Use the Data Adapter Wizard to configure the Adapter.–Right Click the Adapter to preview data and create dataset.•Bind the dataset to controls.•In the Form Load event, use Adapter’s Fill method to load the dataset:•OleDbDataAdapter1.Fill(DataSet11)Creating Bound DataGridView•DataGridView control:–Data Source property:•DataSet–Data Member property•A table in the dataset–In the Form Load event, use Adapter’s Fill method to load the dataset:•OleDbDataAdapter1.Fill(DataSet11)Objects Related to Data Binding•BindingContext: It is an object that manages a collection of data sources used for binding.•CurrencyManager: It is an object that keeps track of position (the current row) of a data source. Two useful properties:–Position property: is the index of the current row. The index is a 0-based index, the first record has a position of 0.–Count property: The number of rows in the data source.Binding Text Box•Select Data Bindings property:–Text: choose field•Add navigation buttons:–The current record position within the data source is stored in the CurrencyManager’s Position property. This position is zero based. Add one move to the next record, minus one move to the previous record.MoveNext and MoveLast Example•MoveNext:– Me.BindingContext(DataSet21,


View Full Document

SF State ISYS 546 - Introduction to ADO.Net, VB.Net Database Tools and Data Binding

Documents in this Course
Load more
Download Introduction to ADO.Net, VB.Net Database Tools and Data Binding
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Introduction to ADO.Net, VB.Net Database Tools and Data Binding and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Introduction to ADO.Net, VB.Net Database Tools and Data Binding 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?