Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

New to VB.NET problem w/ select count(*)

Status
Not open for further replies.

bbwrede

Programmer
May 22, 2003
52
US
Hi,
I just started working w/ VB.NET and I am trying to run a query to select count(*). I am using access and have tried the query out on the dbase and get the correct results.

My problem comes in when I try to access the field from VB.NET.

CReader = Quart.ExecuteReader()
TotalReporting(2) = CReader.Item(0)

I always get the following error:
System.InvalidOperationException: No data exists for the row/column.


I have tried Creader.GetValue(0), GetInt16(0). I have also tried aliasing the count(*) as count1 and trying to access it that way.

What am I doing wrong.

Any help is greatly appreciated.
Thanks,
Barb



 
If you figure something out, post the solution

i'm guessing you either did a CReader.read before trying to read the data or you discovered the ExecuteScalar method of the Command object.



Mark [openup]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top