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

Home Posts Topics Members FAQ

OleDbDataReader

I'm currently using .NET version 2003. I want to be able to retrieve records.
How do I do so using the OleDbDataReader ? Can I have some codes as an example?
Nov 21 '05 #1
3 1449
Hello Nexus,

Dim Com As New OleDbCommand(SQ L ,Con)

Rdr = Com.ExecuteRead er()

Where Con is Connection Object & Rdr is Reader Object

Loop through the Rdr to retrive records.

Partha

"Nexus" <Ne***@discussi ons.microsoft.c om> wrote in message news:B2******** *************** ***********@mic rosoft.com...
I'm currently using .NET version 2003. I want to be able to retrieve records.
How do I do so using the OleDbDataReader ? Can I have some codes as an example?

Nov 21 '05 #2
Nexus,

You can use the OleDbDataReader , that is for reading unsorted or sorted
rows, row by row from a database.

Beter is normally to take the approach from the dataset/datatables, which
gives you in one set all the information you need to do an action.

Maybe it is better you give us an idea what you want to do, because what you
ask now can you better read in books. In this dotNet newsgroup the books
from David Sceppa and William (Bill) Vaughn are always promoted. They both
are active in the newsgroup "Microsoft.publ ic.dotnet.frame work.adonet" when
you want to meet them.

Bill the last times more than David, however David is as well still active
in that.

I hope this helps so far?

Cor

"Nexus"
I'm currently using .NET version 2003. I want to be able to retrieve
records.
How do I do so using the OleDbDataReader ? Can I have some codes as an
example?

Nov 21 '05 #3
Hi,
Dim conn As SqlConnection

Dim strConn As String

Dim drCustomer As SqlDataReader

Dim cmd As SqlCommand

Dim cmdOrders As SqlCommand

Dim ds As New DataSet

strConn = "Server = " + Environment.Mac hineName + ";"

strConn += "Database = NorthWind;"

strConn += "Integrated Security = SSPI;"

conn = New SqlConnection(s trConn)

cmd = New SqlCommand("Sel ect * from Customers", conn)

conn.Open()

drCustomer = cmd.ExecuteRead er

Do While drCustomer.Read

Trace.WriteLine (drCustomer.Ite m("CustomerID") .ToString)

Loop

conn.Close()

Ken

------------------------------------

"Nexus" <Ne***@discussi ons.microsoft.c om> wrote in message
news:B2******** *************** ***********@mic rosoft.com...
I'm currently using .NET version 2003. I want to be able to retrieve
records.
How do I do so using the OleDbDataReader ? Can I have some codes as an
example?
Nov 21 '05 #4

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

Similar topics

3
8131
by: Buddy | last post by:
Hello, How do I get the number of row retrieved on a SELECT query when using OleDbDataReader? I am using Framework 1.0.
10
5609
by: Dion Heskett | last post by:
I wish to supply the formating as a parameter, I have tried OleDbDataReader but get a null ref. just can't seem to get this to work. I think this has something to do with ExecuteReader. also can't seem to use this as the first pram OleDbDataReader reader = new OleDbDataReader() i.e public static string Read(OleDbDataReader reader, string query, string
7
5389
by: Smitty | last post by:
I have a function that imports an Excel file into an Access table using SQL. I then close the OleDataReader and the OleDbConnection, then dispose the OleDbCommand, then OleDbConnection. The calling function then attempts a File.Delete (also tried the FileInfo delete) on the Excel file, but gets the message "The process cannot access the file ... because it is being used by another process". I've stepped through the code and it steps...
1
2711
by: Claudia Fong | last post by:
Hi, I'm using the oleDbDataReader HasRows properties to detect wheter my table contains a record with the parameter below: oleDbConnection1.Close(); objreturnst.Parameters.Value = comboBox2.Text; objreturnst.Parameters.Value = comboBox1.Text; oleDbConnection1.Open();
0
1379
by: Steve1 via DotNetMonster.com | last post by:
Hi all, I''ve created an OleDbDataReader that will contain the number of records that the used SQL query will return. I'm then using a while loop to loop while the OleDBDataReader object has records. I would like to know does the OleDbDataReader contain the actual information on each record i.e. the fields in the database and their values? Or does the ExecuteReader command only contain the number of records present from the used SQL...
1
1970
by: Keith | last post by:
Hi, if have this method in a cs file that connections to a database and returns a datareader to my web form. public OleDbDataReader GetDataReader(string theSQL) { theConn = new OleDbConnection(ConnectionString); theConn.Open(); OleDbCommand cmd = new OleDbCommand(theSQL, theConn);
1
272
by: Steven K | last post by:
Hello, I am using the following code which works. My question is does the OleDbDataReader need to be closed and then re-executed for every control? Is there a more effecient way of doing this other than using a loop? Thanks in advance, Steven Dim spTermType As OleDb.OleDbDataReader
1
2508
by: Rob Richardson | last post by:
Greetings! I have a database created in MS Access that has some fields containing Currency data. Every time I try to use one of the OleDbDataReader's GetXXX() methods to read it, I get an invalid cast exception. Is it possible to use the OleDbDataReader to get the value of a currency field in an Access database? If so, how? Rob, who probably shouldn't even ask this question, since the OleDbDataReader is too simplistic. I should...
1
1495
by: Jerry Spence1 | last post by:
I have been doing the following is VB.Net 2003: Dim dr1 As OleDbDataReader .....Code here If Not dr1 Is Nothing Then
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
10600
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10354
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
9175
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...
0
6867
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
5535
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...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4313
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3835
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.