In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "ADO. NET features and skills is what", in daily operation, I believe many people in ADO. NET features and skills is what the problem is, Xiaobian consulted all kinds of information, sorted out simple and easy to use operation methods, I hope to answer "ADO. NET features and skills is what" doubts help! Next, please follow the small series to learn together!
One thing to note when setting up ADO. NET is that if you do not explicitly provide parameter information, the ADO. NET feature rebuilds the OLE DB parameter accessor using each command execution. This removes the need to parse the command before it is executed and explicitly identifies it as a stored procedure.
DataReader must be closed before accessing any Command-related output parameters. Close DataReader after reading the data. If the connection you are using returns only that DataReader, close the connection immediately after closing the DataReader.
Another way to explicitly close a connection is to pass CommandBehavior.CloseConnection to the ExecuteReader method to ensure that the associated connection is closed when the DataReader is closed. This is especially useful if you return a DataReader from a method and there is no way to control the DataReader or the associated connection to close it.
DataReader cannot be accessed remotely between tiers. ADO. NET features are designed to connect data access. Use typed accessors such as GetString, GetInt32, and so on to access column data. This saves the processing necessary to treat the object returned by GetValue as a specific type.
Only one DataReader can be opened at a time. In ADO, if you open a connection and request two recordsets that use forward-only read-only cursors, ADO implicitly opens a second connection that is not in the connection pool for the datastore of the cursor's lifecycle, and then implicitly closes it. In ADO. NET, if you want to open two DataReaders simultaneously on the same datastore, you must explicitly establish two connections, one for each DataReader. In this way ADO. NET gives you more control over the use of connection pools.
By default, ADO. NET features load the entire row into memory in each Read method. This allows you to randomly access any column of the current row. If random access is unnecessary, the ADO. NET feature passes CommandBehavior.SequentialAccess to the ExecuteReader call to improve performance. This changes DataReader's default behavior to load data into memory only when needed. Note that CommandBehavior.SequentialAccess requires you to access the returned columns in order. That is, once you have read a returned column, you cannot read its value again.
If you are finished reading data from DataReader, but there are still a lot of unread results waiting, it is better to call Cancel of Command than Close of DataReader. Calling DataReader's Close causes it to retrieve the result waiting for and to empty the stream before closing the cursor. Call Cancel of Command to delete the results on the server, so when DataReader is closed, it no longer needs to read the results. If you return output parameters from ADO. NET features, call Cancel to delete them. If you want to read any output parameters, do not call Cancel for Command;*** call Close for DataReader.
At this point, the study of "ADO. NET feature skills is what" is over, hoping to solve everyone's doubts. Theory and practice can better match to help everyone learn, go and try it! If you want to continue learning more relevant knowledge, please continue to pay attention to the website, Xiaobian will continue to strive to bring more practical articles for everyone!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.