473,763 Members | 8,423 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reading through a datareader

This is what I have so far but if someone could show me how to read
through the datareader once I can get the rest.
Thank you.
Private Sub lstCoursesOffer ed_SelectedInde xChanged(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
lstCoursesOffer ed.SelectedInde xChanged
Dim intcount As Integer = 0
mblnLoading = True
If Not mblnStart Then
Dim clsCoursesOffer ed As New CClassReader()
clsCoursesOffer ed.Courses =
mstrCoursesOffe red(lstCoursesO ffered.Selected Index)
Call clsCoursesOffer ed.SelectCourse ()
????? Move clsClass.fieldn ames to txtboxes: txtSection, txtCallNbr,
txtEnroll, txtMaxEnroll,
txtWebVideo(, txtSpecialComme nt, txtTermID)

Load the meeting days checked boxes

?????? Read through the datareader finding the matching DeptId in the
cboDeptId
Set it to be selected

Read through the datareader finding the matching CourseID in the
cboCourseID
Set it to be selected

Read through the datareader finding the matching InstrName in the
cboInstrName
Set it to be selected

Read through the datareader finding the matching
BuildRoomID in the cboBuildRoom
Set it to be selected

Read through the datareader finding the matching ClassType in the
cboClasstype
Set it to be selected

Read through the datareader finding the matching Status in the
cboStatus
Set it to be selected

End If
End Sub

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 20 '05 #1
2 1434
Hi,

Here is the code for a sample console app.

Imports System.Data.Sql Client

Module Module1

Sub Main()
Dim strConn As String
Dim conn As SqlConnection
Dim drCustomer As SqlDataReader
Dim cmd As SqlCommand

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
Console.WriteLi ne(drCustomer(" CustomerID"))
Loop
conn.Close()

End Sub

End Module
Ken
--------------------------
"Sam anonymous" <al************ *@comcast.net> wrote in message
news:uk******** ******@tk2msftn gp13.phx.gbl...
This is what I have so far but if someone could show me how to read
through the datareader once I can get the rest.
Thank you.
Private Sub lstCoursesOffer ed_SelectedInde xChanged(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
lstCoursesOffer ed.SelectedInde xChanged
Dim intcount As Integer = 0
mblnLoading = True
If Not mblnStart Then
Dim clsCoursesOffer ed As New CClassReader()
clsCoursesOffer ed.Courses =
mstrCoursesOffe red(lstCoursesO ffered.Selected Index)
Call clsCoursesOffer ed.SelectCourse ()
????? Move clsClass.fieldn ames to txtboxes: txtSection, txtCallNbr,
txtEnroll, txtMaxEnroll,
txtWebVideo(, txtSpecialComme nt, txtTermID)

Load the meeting days checked boxes

?????? Read through the datareader finding the matching DeptId in the
cboDeptId
Set it to be selected

Read through the datareader finding the matching CourseID in the
cboCourseID
Set it to be selected

Read through the datareader finding the matching InstrName in the
cboInstrName
Set it to be selected

Read through the datareader finding the matching
BuildRoomID in the cboBuildRoom
Set it to be selected

Read through the datareader finding the matching ClassType in the
cboClasstype
Set it to be selected

Read through the datareader finding the matching Status in the
cboStatus
Set it to be selected

End If
End Sub

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #2
while (myDataReader.R ead())

myTextBox.Text = myDataReader("c olName")

wend
"Sam anonymous" <al************ *@comcast.net> wrote in message
news:uk******** ******@tk2msftn gp13.phx.gbl...
This is what I have so far but if someone could show me how to read
through the datareader once I can get the rest.
Thank you.
Private Sub lstCoursesOffer ed_SelectedInde xChanged(ByVal sender As
System.Object, ByVal e As System.EventArg s) Handles
lstCoursesOffer ed.SelectedInde xChanged
Dim intcount As Integer = 0
mblnLoading = True
If Not mblnStart Then
Dim clsCoursesOffer ed As New CClassReader()
clsCoursesOffer ed.Courses =
mstrCoursesOffe red(lstCoursesO ffered.Selected Index)
Call clsCoursesOffer ed.SelectCourse ()
????? Move clsClass.fieldn ames to txtboxes: txtSection, txtCallNbr,
txtEnroll, txtMaxEnroll,
txtWebVideo(, txtSpecialComme nt, txtTermID)

Load the meeting days checked boxes

?????? Read through the datareader finding the matching DeptId in the
cboDeptId
Set it to be selected

Read through the datareader finding the matching CourseID in the
cboCourseID
Set it to be selected

Read through the datareader finding the matching InstrName in the
cboInstrName
Set it to be selected

Read through the datareader finding the matching
BuildRoomID in the cboBuildRoom
Set it to be selected

Read through the datareader finding the matching ClassType in the
cboClasstype
Set it to be selected

Read through the datareader finding the matching Status in the
cboStatus
Set it to be selected

End If
End Sub

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 20 '05 #3

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

Similar topics

1
5687
by: CN | last post by:
Can anyone tell me how to read an XML file into a SqlDataReader? I can pull it into a dataset, but want to have the same formatting capabilities that I have with a DataReader. Thanks.
1
1616
by: et | last post by:
How do I read a dataset so that I get only one value of one field, then read the entire database. For instance, I'm doing a database of bakery products, want to list all cakes. General query, Select * from tblProducts where Category = 'Cakes" So I read the first row so tht I can get a heading, then want to list all items. But because I've already "read" the first row, the list of all items do not contain the first item in my datareader....
3
2366
by: tshad | last post by:
I am trying to set up a class to handle my database accesses. I can't seem to figure out how to get the return value from my dataReader from these routines (most of which I got elsewhere). They do work pretty well, except for the change I made to get the return value. For example, I have the following: ********************************************************************** Public Overloads Function RunProcedure( _ ByVal storedProcName...
7
1694
by: simon | last post by:
What is the best way to read the values from the datatbase. I have sql="SELECT userName, userCountry, userVisit from users where userID=2" Create a command object? Dim oCmd As SqlCommand oCmd = New SqlCommand(sql, Connection) object = oCmd.ExecuteScalar() oCmd.Connection.Close()
6
2232
by: Baal80 | last post by:
Hello, I've managed to read an sql type from the database (using a kind of virtual commandbuilder and SqlDbType method) but I'm not able to retrieve exact data type (eg. maximum length of a varchar field), ie. I can only retrieve "NVarChar" type while the true type name is "NVarChar(50)". I hope you know what I mean, and I really hope somebody here could help me with this. Regards, Mike
2
7381
by: Ed | last post by:
Hope someone can help me out... I have been tasked to read some image data from an sql database and save the files to flat files. OK, sounds easy as I'v used BLOBs before. But this is an old database and I cannot get the image to work. The columns in the database are of type text. Here is one of the images text (in full) in the database (I hope you can see it):
3
2100
by: Oenone | last post by:
I have a project that creates a SqlDataAdapter and uses its Fill method to fill a DataTable with data from a user-provided query. From there I can obviously access details about the rows and columns returned by the query. However, I need to be able to determine the size of the varchar fields that are returned by the query. The obvious answer appeared to be to check the DataColumn.MaxLength property. However, after using the Fill method,...
2
1623
by: thecodewhore | last post by:
OK, so I have a stored procedure that ends like this .... select @PulpMill as pulp_mill, @Supplier + ' - weighted' as supplier, @Species as species select interval_date, weight_multiplied_cqi / total_weight as average_cqi from @WeightedIntervalTable when you actually run the procedure in the Query Analizer it works fine. However im trying to build an Interface in VB.NET that can get the results from it. So far I have.... Try
1
9409
by: dotnetnovice | last post by:
Hi dear fellows...i am a newbie in C# and practicing it hardly to learn it. Actually i am reading a table from data base through data reader and displaying it in the gridview and i am doing well the problem i want to read and display 2 tables at a time in the same grid view. Here is my Code in the class DBHandler. public class DBHandler { private const String ConnectionString = @"initial catalog=FinalProjectDB;Data...
0
9564
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
9387
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,...
0
10148
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...
0
10002
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9938
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
8822
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
6643
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
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
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

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.