?
Solved

VB.NET Compact _How to check/handle an empty data reader?

Posted on 2006-11-30
7
Medium Priority
?
523 Views
Last Modified: 2011-04-14
In a VB.NET compact application I am using a data reader to retrieve data from a SQL Server Mobile db on the device.
If I use
While MyReader.read
and there is no data returned I get an error.
If I use
If MyReader.Read
     While MyReader.Read
and data is returned, the first row will be missing

The .NET Compact Framework does not support MyReader.HasRows.
What is the appropriate code to use for the data reader. Am I just trapping the error like

Try
While MyReader.Read
....
End While
Catch ex as exception
'Code to handle the error caused by the empty datareader
End try
0
Comment
Question by:happyman14
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 10

Expert Comment

by:Kinger247
ID: 18046259
Looks like you'll have to settle with the error block, is the causing any issues ?
0
 

Author Comment

by:happyman14
ID: 18046272
I have not tried simply trapping the error. I thought there might be a better solution.
0
 

Author Comment

by:happyman14
ID: 18046293
I did not want to use the error handling like a branching operation.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Accepted Solution

by:
Kinger247 earned 2000 total points
ID: 18046336
I just tried it an get the same.
I don't see anything wrong in just trapping and moving on as a solution though.
0
 

Author Comment

by:happyman14
ID: 18046462
I Thank you for your speedy reply. I will try it.  I will leave the question open for a little while to see if there is another option, but I am thinking I will prpbably just trap the error.
Thanks
0
 
LVL 10

Expert Comment

by:Kinger247
ID: 18046632
Yes , there might be someone with another solution yet ;)
0
 

Author Comment

by:happyman14
ID: 18046700
Thanks again
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month13 days, 17 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question