News
Articles
Download
Algorithm
Code area
ASP.NET how to optimize the performance problems
1, SqlDataRead and the choice of Dataset
Sqldataread advantages: read data very quickly. If you do not need to return to do a lot of data handling the case, the proposed use SqlDataReader, its much better performance than datset. Disadvantages: until the finish to close out the data in the database connection
(SqlDataReader reading of the data is moving forward. SqlDataReader class provides a read from the SQL Server database search of the only ways into the data flow. It uses SQL Server's local data transmission network connecting directly from the database format to read data. DataReader explicit the need to timely close. Timely release of data link.)
Dataset is to read out the data, the cache in memory. Disadvantages: the memory of the occupation higher. If the return of a large number of data processing to be done Dataset compared with some of the database can reduce the connection operation. Benefits: Just a link in the database can close the connection
* Under normal circumstances, to read large amounts of data, not a lot of data on the return address using SqlDataReader. Handled a large number of returning the data used datset more appropriate. SqlDataReader and Dataset on the choice of procedure depends on the function of the realization.
Second, ExecuteNonQuery and ExecuteScalar
The update of the data sets do not need to return results, the proposed use ExecuteNonQuery. As not to return result sets can be saved network data transmission. It is merely to return to the affected lines. If only updated data using the ExecuteNonQuery performance overhead is relatively small.
ExecuteScalar only return results on the first line of the first row. ExecuteScalar method of using the database to retrieve a single value (for example, id). And the use of ExecuteReader method, to return to the implementation of the data generated for the operation of a single value compared to the needs of this operation code less.
* Just to update the data used ExecuteNonQuery. For the use of a single value of the data binding choice ExecuteScalar
Third, the data binding DataBinder
General binding methods used do not have to concern DataBinder.eval binding data sources (Dataread or dataset). Do not have to care about the type of data will be eval this data object into a string. In the bottom bundled done a lot of work, the use of a reflective properties. It is precisely because of the ease of use, but it affected the performance data. Under the terms. When bundled in the dataset when, DataItem a fact-DataRowView (if the bonding is a data reader (dataread) it is a IdataRecord.) Directly into DataRowView Therefore, it would have a great performance to improve.
* Binding recommendations on the use of the data. Large amount of data can increase the speed of several hundred times. Note 2 when: 1. .2 Need to add pages. Attention to the field were the case (with special attention to). If the enquiries and inconsistent, in some cases will lead to even slower than that. If you want to further improve the speed, may be the way. However, its readability is not high.
Vb.net is over the wording. In the c #: <@% ((DataRowView) Container.DataItem) [ "fieldname"]%>
See pages of each state of the implementation of the most simple way: the trace of its pages can be read attribute to true details.
First, the use of stored procedures:
1, performance areas: storage process provides many standard sql language not found in the advanced features. Its transmission parameters and the implementation of logical expression of features to help application designers to handle complex tasks. In addition, the process of memory storage in the local server, a decrease of the implementation of the process and the implementation of broadband network transmission time. (Storage process has been on the sql statements were pre-compiled, so its implementation faster than in the implementation process, much faster sql statement)
2, program structure: from the process of scalability, the use of stored procedures after the amendment process will bring convenience. For instance, the database structure has changed, just modify corresponding to the storage structure, and procedures can be part of the call. This part does not belong to the scope of this paper, a procedural structure design. So this is not start.
3, security procedures: the use of stored procedures to prevent SQL Injection attacks.
View:(226) comments:(0)
Nickname:
comments:
About esoftwarefactory.com
|
Sitemap
|
Newletter
|
Tags
|
Advertise
Partners:
best dvd copy software
Copyright ©2008
Freeware shareware downloads
- esoftwarefactory.com, All Rights Reserved