In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what are the matters needing attention in creating an ADO connection". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn what matters needing attention in creating an ADO connection.
If you want to refresh the values in the dataset from the server with the updated values, use the ADO connection. If the primary key is defined on the data table, DataAdapter.Fill matches the new row based on the primary key and changes the server's data to an existing row.
◆ must turn off DataReader before accessing any output parameters of the relevant Command.
◆ always closes DataReader after finishing reading the data. If you use Connection only to return DataReader, close DataReader immediately after closing it.
Another way to explicitly close the Connection is to pass the CommandBehavior.CloseConnection to the ExecuteReader method to ensure that the relevant connection is closed when the ADO.NET DataReader is closed. This is especially useful if you return DataReader from a method and you cannot control the closure of DataReader or related connections.
◆ cannot remotely access DataReader between tiers. DataReader is designed for connected data access.
◆ uses typed accessors, such as GetString, GetInt32, and so on, when accessing column data. This frees you from the processing required to cast the Object returned by GetValue to a specific type.
◆ A single connection can only open one DataReader at a time. In an ADO connection, if you open a single connection and request two recordsets that use forward-only, read-only cursors, the ADO connection implicitly opens a second, unpooled connection to the datastore during the lifetime of the cursor, and then implicitly closes the connection. For ADO.NET, Secret does very little. If you want to open both DataReaders on the same datastore, you must explicitly create two connections, one for each DataReader. This is one way that ADO.NET provides more control over the use of pooled connections.
◆ ExecuteReader call. This changes the default behavior of DataReader to load data into memory only when requested. Note that CommandBehavior.SequentialAccess requires sequential access to the returned columns. That is, once you have read the returned column, you can no longer read its value.
If you have finished reading the data from DataReader, but there are still a large number of pending unread results, call Command's Cancel before calling DataReader's Close. Calling the Close of DataReader causes the pending results to be retrieved and the stream emptied before closing the cursor. Calling Command's Cancel discards the results on the server so that DataReader doesn't have to read them when it shuts down. If you want to return output parameters from Command, call Cancel to discard them. If you need to read any output parameters, don't call Command's Cancel, just call DataReader's Close.
When you retrieve a binary large object (BLOB) with DataReader, you should pass the CommandBehavior.SequentialAccess to the ExecuteReader method call. Because the default behavior of DataReader is to load the entire row into memory every time Read, and because the BLOB value can be very large, a large amount of memory may be used up as a result of a single BLOB. SequentialAccess sets the behavior of DataReader to load only the requested data. You can then use GetBytes or GetChars to control how many ADO connections are loaded at a time.
Remember, when using SequentialAccess, you cannot access the different fields returned by DataReader out of order. That is, if the query returns three columns, the third column is BLOB, and you want to access the data in the first two columns, you must access the value of the * column before accessing the BLOB data, and then access the value of the second column. This is because the data is now returned sequentially, and once the data has been read by the ADO connection, it is no longer available.
Thank you for your reading, the above is the content of "what are the considerations for creating an ADO connection?" after the study of this article, I believe you have a deeper understanding of what matters needing attention in creating an ADO connection, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.