datareader

Big Performance Problems With Oracle DataReader in .Net

半城伤御伤魂 提交于 2019-12-02 04:33:11
I have a few Oracle procedures that generate/return a large amount of data that I need to write out to a file. I'm currently trying to accomplish with a data-reader. It seems to be working, I've successfully generated a 479mb file without any trouble. It took less than 4 minutes from the time I retrieved the dataReader to complete the file. But the dataReader I get for a particular procedure is crawling . It's unbelievably slow. I modified my code to try and get a better idea of what is going on.... System.Diagnostics.Debug.Write("Performing .Read() on DataReader: ") Dim d1 As DateTime =

How much data can be stored in network buffer when datareader is used

你离开我真会死。 提交于 2019-12-01 21:14:57
all we know that datareader works like The datareader reads a record at a time, but it reads it from the underlying database driver. The database driver reads data from the database in blocks, typically using a buffer that is 8 kilobytes. If your result records are small and you don't get very many, they will all fit in the buffer, and the database driver will be able to feed them all to the data reader without having to ask the database for more data. If you fetch a result that is larger than the buffer, you will only be able to read the first part of it and when there will no data exist in

Close reader before closing connection

时间秒杀一切 提交于 2019-12-01 18:12:24
问题 Should you always close a DataReader before closing the connection, or is it okay to just close the connection? By just closing the connection does that effectively close the reader? (This is for c#.net 3.5) Thanks! 回答1: Aside from making your intent clear, there is this from the Microsoft documentation (Retrieving Data Using a DataReader (ADO.NET)): You should always call the Close method when you have finished using the DataReader object. 回答2: Close the DataReader as well. imo. if it

Can a binary search be done in a database in SQL?

守給你的承諾、 提交于 2019-12-01 09:50:36
OK. I am using the C# programming language to access a simple database (on Microsoft SQL Server) Currently, I am using the DataReader object to access the database. So here is my question: is it possible to do a binary search (in C#) for a particular piece of data so that i can make the search faster? Currently, I'm using a simple while loop to search the contents of the database. I believe this is done sequentially. while (pReader.Read()) { if ((String)pReader["theData"] == "The_thing_im_searching_for") break; } So is there any way to do a binary search? If you're using a database anyways,

Can a binary search be done in a database in SQL?

ε祈祈猫儿з 提交于 2019-12-01 06:11:06
问题 OK. I am using the C# programming language to access a simple database (on Microsoft SQL Server) Currently, I am using the DataReader object to access the database. So here is my question: is it possible to do a binary search (in C#) for a particular piece of data so that i can make the search faster? Currently, I'm using a simple while loop to search the contents of the database. I believe this is done sequentially. while (pReader.Read()) { if ((String)pReader["theData"] == "The_thing_im

Using MySQL Data Reader

不羁的心 提交于 2019-12-01 05:27:32
问题 I'm not familiar with using Data Reader, i need help with the following code, i want to retrieve a single data from the database. MySqlDataAdapter data = new MySqlDataAdapter(cmd); conn.Open(); DataTable dt = new DataTable(); data.Fill(dt); gridView1.DataSource = dt; int retrievedValue = 0; using (MySqlDataReader reader = cmd.ExecuteReader()) { while (reader.Read()) { if ((int)reader["order_status"] == 0) { retrievedValue = (int)reader.GetValue(0); GridView View2 = sender as GridView; e

Handle NULL values when reading through OracleDataReader?

假如想象 提交于 2019-12-01 03:15:17
I'm working on my first ASP.Net application, and seem to be hitting a lot of hurdles (background primarily in WinForms with a recent MVC5 project under my belt). I am successfully making my DB connection using OracleCommand and executing my query, but when I try reading through the rows I am getting a Column contains NULL value on the second row for odr.GetDecimal(1) . Anyone know how to handle null values when reading through an OracleDataReader? Below is my code: List<YearsOfService> yearsOfService = new List<YearsOfService>(); string SQL = "SELECT SCHOOL_YEAR as YEAR, " + "TOTAL_SERVICE

DataReader - hardcode ordinals?

醉酒当歌 提交于 2019-12-01 03:05:35
When returning data from a DataReader I would typically use the ordinal reference on the DataReader to grab the relevant column: if (dr.HasRows) Console.WriteLine(dr[0].ToString()); or if (dr.HasRows) Console.WriteLine(dr.GetString(0)); or if (dr.HasRows) Console.WriteLine((string)dr[0]); I have always done this because I was advised at an early stage that using dr["ColumnName"] or a more elegant way of indexing causes a performance hit. However, while all references to data entities are becoming increasingly strongly-typed I feel more uncomfortable with this. I'm also aware that the above

WinRT No mapping for the Unicode character exists in the target multi-byte code page

徘徊边缘 提交于 2019-11-30 17:58:52
I am trying to read a file in my Windows 8 Store App. Here is a fragment of code I use to achieve this: if(file != null) { var stream = await file.OpenAsync(FileAccessMode.Read); var size = stream.Size; using(var inputStream = stream.GetInputStreamAt(0)) { DataReader dataReader = new DataReader(inputStream); uint numbytes = await dataReader.LoadAsync((uint)size); string text = dataReader.ReadString(numbytes); } } However, an exeption is thrown at line: string text = dataReader.ReadString(numbytes); Exeption message: No mapping for the Unicode character exists in the target multi-byte code page

DataReader.GetFieldType returned null

痴心易碎 提交于 2019-11-30 14:52:49
问题 In my db table Layout, there's one column whose type is hierarchyid (column index=4). When trying to set-up new environment (a virtual web-server, created from XEN server), then running the site, I've met with this issue: Exception message: DataReader.GetFieldType(4) returned null. Exception data: System.Collections.ListDictionaryInternal I've made some search and found out there are already some topic on it (such as on MSDN). But even when I added the C:\Program Files\Microsoft SQL Server