473,804 Members | 2,225 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Prefetch

Hi,
I'm receveing an IDataReader object that I bind to a combo list.

I'd like to be able to customize that object before binding it to combo,
but I don't know how to do it...

Ideal would be something aka:

foreach('MyFiel d' in IDataReader.Row s){

If ('MyField'== "Male")
IDataReader.Row .Remove('MyFiel d');
};

TIA
Nov 16 '05 #1
6 3539

"Peter Osawa" <po****@sun.e s> wrote in message
news:Oh******** *****@TK2MSFTNG P10.phx.gbl...
Hi,
I'm receveing an IDataReader object that I bind to a combo list.

I'd like to be able to customize that object before binding it to combo,
but I don't know how to do it...

Ideal would be something aka:

foreach('MyFiel d' in IDataReader.Row s){

If ('MyField'== "Male")
IDataReader.Row .Remove('MyFiel d');
};


Use a DataTable instead of a DataReader. Then you can do whatever you want
to it.

David
Nov 16 '05 #2
The problem es that I receive the IDataReader and I'm not allowed to
change that...

David Browne wrote:
"Peter Osawa" <po****@sun.e s> wrote in message
news:Oh******** *****@TK2MSFTNG P10.phx.gbl...
Hi,
I'm receveing an IDataReader object that I bind to a combo list.

I'd like to be able to customize that object before binding it to combo,
but I don't know how to do it...

Ideal would be something aka:

foreach('MyFi eld' in IDataReader.Row s){

If ('MyField'== "Male")
IDataReader.R ow.Remove('MyFi eld');
};

Use a DataTable instead of a DataReader. Then you can do whatever you want
to it.

David

Nov 16 '05 #3

"Peter Osawa" <po****@sun.e s> wrote in message
news:eJ******** *****@TK2MSFTNG P11.phx.gbl...
The problem es that I receive the IDataReader and I'm not allowed to
change that...

David Browne wrote:
"Peter Osawa" <po****@sun.e s> wrote in message
news:Oh******** *****@TK2MSFTNG P10.phx.gbl...
Hi,
I'm receveing an IDataReader object that I bind to a combo list.

I'd like to be able to customize that object before binding it to combo,
but I don't know how to do it...

Ideal would be something aka:

foreach('MyFi eld' in IDataReader.Row s){

If ('MyField'== "Male")
IDataReader.R ow.Remove('MyFi eld');
};

Use a DataTable instead of a DataReader. Then you can do whatever you want
to it.

David


The following will convert the Reader to a DataTable. I don't know how to do
this using any methods on any of the Sql objects, because I haven't spent much
time with the Reader specifically. So I wrote this quickly to help you in your
situation.

Hope it helps!

Mythran
' --------------------------------------------------------------------------
' Description:
' Sample MAIN() console application.
'
Sub Main()
Dim conn As SqlConnection
Dim read As SqlDataReader
Dim adap As SqlDataAdapter
Dim dt As DataTable
Dim cmd As SqlCommand

conn = New
SqlConnection(" Server=MyServer ;Database=MyDat abase;Trusted_C onnection=True" )
conn.Open()

cmd = New SqlCommand("SEL ECT * FROM tblDepartment", conn)
read = cmd.ExecuteRead er()

' Convert the reader to a data table.
dt = ConvertReaderTo DataTable(read)

' Close the reader and the database connection.
read.Close()
conn.Close()

' Write the first row of the data table.
For Each col As DataColumn In dt.Columns
Console.WriteLi ne("Name: " & col.ColumnName & _
" - Value: " & dt.Rows(0)(col) .ToString())
Next
End Sub

' --------------------------------------------------------------------------
' Description:
' Convert the reader to a data table.
'
Public Function ConvertReaderTo DataTable(ByVal Reader As SqlDataReader) As
DataTable
Dim dt As DataTable
Dim dr As DataRow

' Create the data table.
dt = New DataTable()

' Add the columns from the reader to the schema of the data table.
For i As Integer = 0 To Reader.FieldCou nt - 1
dt.Columns.Add( Reader.GetName( i), Reader.GetField Type(i))
Next

' Add each row in the reader to the data table.
While Reader.Read()
' Create the new row.
dr = dt.NewRow()

For i As Integer = 0 To Reader.FieldCou nt - 1
dr(i) = Reader(i)
Next

' Add the row to the table.
dt.Rows.Add(dr)
End While

' Return the DataTable object.
Return dt
End Function

Nov 16 '05 #4
Sorry about my previous post in VB.Net, it's not hard to convert to C#, but
still, sorry ... didn't notice this was the C# group until after I posted
heh...let me know if you have problems converting to C#...if you do I'll go ahead
and convert it to the equivalent.

....

Mythran

"Peter Osawa" <po****@sun.e s> wrote in message
news:eJ******** *****@TK2MSFTNG P11.phx.gbl...
The problem es that I receive the IDataReader and I'm not allowed to
change that...

David Browne wrote:
"Peter Osawa" <po****@sun.e s> wrote in message
news:Oh******** *****@TK2MSFTNG P10.phx.gbl...
Hi,
I'm receveing an IDataReader object that I bind to a combo list.

I'd like to be able to customize that object before binding it to combo,
but I don't know how to do it...

Ideal would be something aka:

foreach('MyFi eld' in IDataReader.Row s){

If ('MyField'== "Male")
IDataReader.R ow.Remove('MyFi eld');
};

Use a DataTable instead of a DataReader. Then you can do whatever you want
to it.

David

Nov 16 '05 #5

"Peter Osawa" <po****@sun.e s> wrote in message
news:eJ******** *****@TK2MSFTNG P11.phx.gbl...
The problem es that I receive the IDataReader and I'm not allowed to
change that...


Well, that's bad design.

But you can create the DataTable yourself and read through the DataReader
and add rows to the DataTable. You're replicating code that already exists
in the DataAdapter.

David
Nov 16 '05 #6
I'll try it

Thank you

Mythran wrote:
Sorry about my previous post in VB.Net, it's not hard to convert to C#, but
still, sorry ... didn't notice this was the C# group until after I posted
heh...let me know if you have problems converting to C#...if you do I'll go ahead
and convert it to the equivalent.

...

Mythran

"Peter Osawa" <po****@sun.e s> wrote in message
news:eJ******** *****@TK2MSFTNG P11.phx.gbl...
The problem es that I receive the IDataReader and I'm not allowed to
change that...

David Browne wrote:

"Peter Osawa" <po****@sun.e s> wrote in message
news:Oh***** ********@TK2MSF TNGP10.phx.gbl. ..
Hi,
I'm receveing an IDataReader object that I bind to a combo list.

I'd like to be able to customize that object before binding it to combo,
but I don't know how to do it...

Ideal would be something aka:

foreach('My Field' in IDataReader.Row s){

If ('MyField'== "Male")
IDataReader .Row.Remove('My Field');
};
Use a DataTable instead of a DataReader. Then you can do whatever you want
to it.

David


Nov 16 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
4353
by: Li Kao | last post by:
After incrementally increasing SORTHEAP (and the commensurate increase in SHEAPTHRES) and *slightly* reducing the bufferpool size, I find that my query is no longer taking advantage of async IO for reads. I discovered this message in the db2diag.log: ==================================== PID:80850(db2agntp (LIKAO) 0) Appid:*LOCAL.db2inst1.031121211302 sort/list_services sqlsOptimizeNumMergeRuns Probe:10 Database:LIKAO
4
3686
by: Erik Hendrix | last post by:
Hi, I have a quick question, when one sets the prefetch size = extent size, then when doing a backup we will have 1 agent (db2bm) doing the reads. If we have prefetch size a multiple of extent size AND we have multiple containers and/or PARALLEL_IO set then not db2bm but the db2 prefetchers will read the data. Now no matter which one reads the data, it will still be read in 1 extent size. Wouldn't it thus be much more efficient to...
1
6257
by: Erik Hendrix | last post by:
Hi, I have a question here regarding setting the prefetch size. So far we took the rule that for OLTP, prefetchsize = extent size and for DSS prefetchsize = extent size * number. However, especially due to the "Skip Scans" for indexes I started to question this. It looks to me that for reading a index DB2 will or do a synchronous read or he will have to scan the whole index and thus prefetch the data correct? If this is so, then it...
2
1709
by: Jean-Marc Blaise | last post by:
Dear all, If you do a SELECT * FROM TAB WHERE DATE=?, the explain plan might pick up a TBSCAN and you'll see in db2exfmt PREFETCH=SEQUENTIAL. Now, TAB is a MDC, and DATE is a dimension. The explain plan will pick up the block index and db2exfmt indicates PREFETCH=NONE. However, monitoring bufferpools shows async IO is done. Would it make sense to have db2exfmt indicate in that case
6
1267
by: Ioannis Theoharis | last post by:
Hi, i have 3 tables calling father, child1, child2: create table father(att0 int4); create table child1() inherits(father); create table child2() inherits(father); i want to get all the instances of the hierarchy:
3
8240
by: rdudejr | last post by:
Hi all, Ive got a database approx 350 GB in which Im getting very high Time waited for prefetch. This is directly out of the snapshot for the db (these are for the entire database I assume as I pulled it out of get snapshot for all on {dbname}) Total buffer pool read time (milliseconds) = 45660639 Total buffer pool write time (milliseconds)= 42128058 Total elapsed asynchronous read time = 33856320
1
3197
by: msasha | last post by:
Hi all. I'm trying to parse some HTML received from an untrusted remote source. What I've been trying so far is something along the lines of: var htmlString = "<script language=\"text/javascript\">alert(\"Hello\");</script>" + "<img src=\"http://www.jinchess.com/chessboard/?pos=Ra6\">"; var div = $doc.createElement('div'); div.innerHTML = htmlString;
0
1281
by: dunleav1 | last post by:
Does it make sense to set prefetch automatic on a temp tablespace?
1
1664
by: =?Utf-8?B?Sm9ubnk=?= | last post by:
Hi. I an pulling my hair out with this one and hope somebody can help me.I started getting a message on startuo saying windows/prefetch/explorer.exe -082F38A9.pf is corrupt.Since then every time i turn on computer the start and icons only stay on the screen for a few seconds then dissapear.The last day or so sometimes i just get the home edition screen shwing with nothing else.The only way i can get online is by alt ctrl and del to get up...
0
9715
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9595
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10356
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9176
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7643
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3836
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3003
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.