Please support our VB.NET advertiser: Programming Forums
Views: 14864 | Replies: 4
![]() |
What is the error you are getting?
You could do a test for the number of records and only loop if it is greater than 0.
And how are you looping through the table?
Pseudo-Code:
Hope this helps
You could do a test for the number of records and only loop if it is greater than 0.
And how are you looping through the table?
Pseudo-Code:
Dim dr As OleDbDataReader = cmd.ExecuteReader() Do While dr.Read ... ... Loop
Hope this helps
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
•
•
Join Date: May 2005
Posts: 12
Reputation:
Rep Power: 4
Solved Threads: 0
Dim myConnStr As String = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=" + myPath
Dim myConn As New OleDb.OleDbConnection(myConnStr)
Dim myAdapt As New OleDb.OleDbDataAdapter(myQuery, myConn)
Try
myConn.Open()
Dim myReader As New DataSet
myAdapt.Fill(myReader)
**
** I need to check if myReader is empty
**
tbGATE.Text = myReader.Rows(0)("dGate")
tbCONC.Text = myReader.Rows(0)("dConc")
tbPAY.Text = myReader.Rows(0)("dPayment")
**
** I need to check if myReader.Rows(0)("dWeather") is empty
**
cbWEATHER.DisplayMember = myReader.Rows(0)("dWeather")
myConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Dim myConn As New OleDb.OleDbConnection(myConnStr)
Dim myAdapt As New OleDb.OleDbDataAdapter(myQuery, myConn)
Try
myConn.Open()
Dim myReader As New DataSet
myAdapt.Fill(myReader)
**
** I need to check if myReader is empty
**
tbGATE.Text = myReader.Rows(0)("dGate")
tbCONC.Text = myReader.Rows(0)("dConc")
tbPAY.Text = myReader.Rows(0)("dPayment")
**
** I need to check if myReader.Rows(0)("dWeather") is empty
**
cbWEATHER.DisplayMember = myReader.Rows(0)("dWeather")
myConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
(For sake of confusion, I would not name my Dataset as myReader - seems to refer to a datareader to someone not knowing what you are coding for.... just some programming edicate I thought I should pass on)
Saying that......
Add the line
If myReader.Tables("dWeather").Rows.Count > 0 Then
Hope this helps
Saying that......
Add the line
If myReader.Tables("dWeather").Rows.Count > 0 Then
Hope this helps
•
•
•
•
Originally Posted by Robert Walker
Dim myConnStr As String = "Provider=Microsoft.jet.OLEDB.4.0;Data Source=" + myPath
Dim myConn As New OleDb.OleDbConnection(myConnStr)
Dim myAdapt As New OleDb.OleDbDataAdapter(myQuery, myConn)
Try
myConn.Open()
Dim myReader As New DataSet
myAdapt.Fill(myReader)
**
** I need to check if myReader is empty
**
tbGATE.Text = myReader.Rows(0)("dGate")
tbCONC.Text = myReader.Rows(0)("dConc")
tbPAY.Text = myReader.Rows(0)("dPayment")
**
** I need to check if myReader.Rows(0)("dWeather") is empty
**
cbWEATHER.DisplayMember = myReader.Rows(0)("dWeather")
myConn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
Assistant Manager, Regional Pharmacy Information Systems
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
TLC Services Website (Under Construction)
Updated : ASP.Net Login Code
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 2 (0 members and 2 guests)





Linear Mode