Server-side data access summary:

zhaozj2021-02-16  68

The hosted data of the public language runtime is accessed by the API abstract data and indicates that it is used in a consistent manner, independent of the actual data source (SQL Server, OLEDB, XML, etc.). In order to enable the page to access the class required to perform SQL data access, you must import system.data and system.data.sqlclient namespace into the page. From the SQL query population dataset involves creating SQLConnection, the SQLDataAdapter object is associated with the connection containing the query statement and populates the data set from the command. The DataGrid control supports the iEnumerable (or iCollection) type DataSource property. This can be set to the result of SQL query by assigning DAVIEW DEFAULTVIEW attributes (DataView type). SqlDataAdapter maintains a parameter collection that can be used to replace variable identifiers ("@" before the name. Use SQLCOMMAND when performing commands that do not return data (such as insert, update, and delete), instead of SqlDataAdapter. This command is sent by calling the ExecuteNonQuery method, and the method returns the number of rows affected. When using SQLCommand, you must explicitly open SQLConnection (SqlDataAdapter automatically processes the connection). Always remember to turn off the SQLConnection with the data model before the page is executed. If the connection is not closed, it may not exceed the connection limit when the waiting page instance is collected by garbage. In order to allow pairs to be edited, the DataGrid supports the integer EditIndex property, which indicates which line of the grid should be editable. After setting this property, the DataGrid is rendered as a text input box, not a simple label. DataGrid discloses a DataKeyField property that can be set to the primary key field name. In the event handler connected to the UpdateCommand, you can retrieve the key name from the DataGrid's DataKeys collection. Using the BoundColumn control in DataGrid allows you to fully control the order of columns, and their ReadOnly properties. Use the TemplateColumn control in DataGrid to fully control the contents of the column. The ButtonColumn control can be used to render only button controls in each row, and the column can be associated with an event. HyperLinkColumn can be added to the DataGrid Column Set, which is supported to be positioned to another page when clicking on the link. When the DataGrid's baseort property is set to True, it presents the hyperlink of the Sort command excited back to the grid. Set the DataGrid's onsortCommand property to the handler to call when the user clicks the column link. DataSet supports the fileStream as the READXML, READXMLDATA, and READXMLSCHEMA methods for parameters, and this parameter can be used to populate DataSet from the XML file. Using a stored procedure can reduce the overhead of performing heavy database operations in your application.

转载请注明原文地址:https://www.9cbs.com/read-13233.html

New Post(0)