473,382 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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 lstCoursesOffered_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lstCoursesOffered.SelectedIndexChanged
Dim intcount As Integer = 0
mblnLoading = True
If Not mblnStart Then
Dim clsCoursesOffered As New CClassReader()
clsCoursesOffered.Courses =
mstrCoursesOffered(lstCoursesOffered.SelectedIndex )
Call clsCoursesOffered.SelectCourse()
????? Move clsClass.fieldnames to txtboxes: txtSection, txtCallNbr,
txtEnroll, txtMaxEnroll,
txtWebVideo(, txtSpecialComment, 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 1418
Hi,

Here is the code for a sample console app.

Imports System.Data.SqlClient

Module Module1

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

strConn = "Server = " + Environment.MachineName + ";"
strConn += "Database = NorthWind;"
strConn += "Integrated Security = SSPI;"

conn = New SqlConnection(strConn)
cmd = New SqlCommand("Select * from Customers", conn)
conn.Open()
drCustomer = cmd.ExecuteReader
Do While drCustomer.Read
Console.WriteLine(drCustomer("CustomerID"))
Loop
conn.Close()

End Sub

End Module
Ken
--------------------------
"Sam anonymous" <al*************@comcast.net> wrote in message
news:uk**************@tk2msftngp13.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 lstCoursesOffered_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lstCoursesOffered.SelectedIndexChanged
Dim intcount As Integer = 0
mblnLoading = True
If Not mblnStart Then
Dim clsCoursesOffered As New CClassReader()
clsCoursesOffered.Courses =
mstrCoursesOffered(lstCoursesOffered.SelectedIndex )
Call clsCoursesOffered.SelectCourse()
????? Move clsClass.fieldnames to txtboxes: txtSection, txtCallNbr,
txtEnroll, txtMaxEnroll,
txtWebVideo(, txtSpecialComment, 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.Read())

myTextBox.Text = myDataReader("colName")

wend
"Sam anonymous" <al*************@comcast.net> wrote in message
news:uk**************@tk2msftngp13.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 lstCoursesOffered_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
lstCoursesOffered.SelectedIndexChanged
Dim intcount As Integer = 0
mblnLoading = True
If Not mblnStart Then
Dim clsCoursesOffered As New CClassReader()
clsCoursesOffered.Courses =
mstrCoursesOffered(lstCoursesOffered.SelectedIndex )
Call clsCoursesOffered.SelectCourse()
????? Move clsClass.fieldnames to txtboxes: txtSection, txtCallNbr,
txtEnroll, txtMaxEnroll,
txtWebVideo(, txtSpecialComment, 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
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
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,...
3
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...
7
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...
6
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...
2
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...
3
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...
2
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 /...
1
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.