Implementing Windows Data Binding

Source: Internet
Author: User

DataSet DataSet resides in memory temporarily stores data
Simple to understand as a temporary database
Save data from a data source in memory
Independent of any database
Create a DataSet object
Introduce a namespace: System. Data
DataSet DataSet Object =new DataSet ();
DataSet ds=new DataSet ();
SelectCommand Property
A Command object
Retrieving data from a data source
Fill () method
Populating a DataSet with the results of SelectCommand
Dataadapte Objects of different namespaces
The Dataadaptec object that corresponds to the namespace
System. Data.sqlclient Sqldataadapte
System.Data.OleDb OleDbDataAdapter
System.Data.Odbc OdbcDataAdapter
System.Data.OracleClient OracleDataAdapter

DataSet dataset can manipulate data in the case of disconnection, bulk operation of the data, and its principle is similar to the SQL Server receipt Library
Populating the data with the DataAdapter Fill method


Combox Data Binding Three properties
DataSource: Data source
ValueMember: Actual value
DisplayMember: The value displayed

Displaying Data using DataGridView

Use Sqlcommandbuider objects to automatically generate
Insert command: InsertCommand
Update command: UpdateCommand
Delete command: DeleteCommand
Updating a database with Sqlcommandbuider can only be used for single-table operations and contains primary key columns
To set the properties of the DataGridView control and its columns
Setting the DATASOURCR property, binding the data source
this.dgvstuname.datasource=ds.tables["Student"]


Important attributes of DataGridView
Property name Description
Columns contains a collection of columns
Data sources for DataSource DataGridView
ReadOnly whether to edit cells
Antogeneratecolummns set DataGridView Whether to create columns automatically
SelectionMode How to select Datagridviewview cells
Rowheadersvisible whether the header row is displayed
MultiSelect allows you to select multiple cells, rows, columns

Main properties of columns in DataGridView
Property name Description
HeaderText column Header text
visible Specifies whether the column is visible
ReadOnly whether the specified cell is read-only
Types of ColumnType Columns
Frozen whether the column moves when horizontal scrolling
DataPropertyName the name of the bound data column

If duplicate data appears in DataGridView, first check whether the table is emptied before filling

Implementing Windows Data Binding

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.