473,326 Members | 2,813 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,326 software developers and data experts.

error in asp : invalid attempt to read when no data is present

Below is the error I am receiving. I have checked SQL Profiler and it is
receiving the correct query which runs fine in Query Analyzer. Any ideas?
Server Error in '/lockinsheet' Application.
----------------------------------------------------------------------------
----

Invalid attempt to read when no data is present.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Invalid attempt to read
when no data is present.

Source Error:

Line 135: myDataReader = myCommand.ExecuteReader()
Line 136:
Line 137: LoanNo.Text = myDataReader.Item("LoanNo")
Line 138: LoanOfficer.Text = myDataReader.Item("LoanOfficer")
Line 139: SubBy.Text = myDataReader.Item("SubBy")

Source File: c:\inetpub\wwwroot\lockinsheet\Report.aspx.vb Line: 137

Stack Trace:

[InvalidOperationException: Invalid attempt to read when no data is
present.]
System.Data.SqlClient.SqlDataReader.PrepareRecord( Int32 i)
System.Data.SqlClient.SqlDataReader.GetValue(Int32 i)
System.Data.SqlClient.SqlDataReader.get_Item(Strin g name)
lockinsheet.Report.displaydata() in
c:\inetpub\wwwroot\lockinsheet\Report.aspx.vb:137
lockinsheet.Report.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\lockinsheet\Report.aspx.vb:119
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()

----------------------------------------------------------------------------
----
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET
Version:1.1.4322.573
Nov 17 '05 #1
2 5185
You have to call the Read method of the datareader before accessing the
fields of the first row. It will return True if a row was fetched, and False
otherwise.

"Brent Burkart" <Br***********@wvmb.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Below is the error I am receiving. I have checked SQL Profiler and it is
receiving the correct query which runs fine in Query Analyzer. Any ideas?
Server Error in '/lockinsheet' Application.
-------------------------------------------------------------------------- -- ----

Invalid attempt to read when no data is present.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Invalid attempt to read when no data is present.

Source Error:

Line 135: myDataReader = myCommand.ExecuteReader()
Line 136:
Line 137: LoanNo.Text = myDataReader.Item("LoanNo")
Line 138: LoanOfficer.Text = myDataReader.Item("LoanOfficer")
Line 139: SubBy.Text = myDataReader.Item("SubBy")

Source File: c:\inetpub\wwwroot\lockinsheet\Report.aspx.vb Line: 137

Stack Trace:

[InvalidOperationException: Invalid attempt to read when no data is
present.]
System.Data.SqlClient.SqlDataReader.PrepareRecord( Int32 i)
System.Data.SqlClient.SqlDataReader.GetValue(Int32 i)
System.Data.SqlClient.SqlDataReader.get_Item(Strin g name)
lockinsheet.Report.displaydata() in
c:\inetpub\wwwroot\lockinsheet\Report.aspx.vb:137
lockinsheet.Report.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\lockinsheet\Report.aspx.vb:119
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()

-------------------------------------------------------------------------- -- ----
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

Nov 17 '05 #2
myDataReader.Read() ' before Line 137
"Brent Burkart" <Br***********@wvmb.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Below is the error I am receiving. I have checked SQL Profiler and it is
receiving the correct query which runs fine in Query Analyzer. Any ideas?
Server Error in '/lockinsheet' Application.
-------------------------------------------------------------------------- -- ----

Invalid attempt to read when no data is present.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Invalid attempt to read when no data is present.

Source Error:

Line 135: myDataReader = myCommand.ExecuteReader()
Line 136:
Line 137: LoanNo.Text = myDataReader.Item("LoanNo")
Line 138: LoanOfficer.Text = myDataReader.Item("LoanOfficer")
Line 139: SubBy.Text = myDataReader.Item("SubBy")

Source File: c:\inetpub\wwwroot\lockinsheet\Report.aspx.vb Line: 137

Stack Trace:

[InvalidOperationException: Invalid attempt to read when no data is
present.]
System.Data.SqlClient.SqlDataReader.PrepareRecord( Int32 i)
System.Data.SqlClient.SqlDataReader.GetValue(Int32 i)
System.Data.SqlClient.SqlDataReader.get_Item(Strin g name)
lockinsheet.Report.displaydata() in
c:\inetpub\wwwroot\lockinsheet\Report.aspx.vb:137
lockinsheet.Report.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\lockinsheet\Report.aspx.vb:119
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()

-------------------------------------------------------------------------- -- ----
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

Nov 17 '05 #3

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

Similar topics

2
by: Matthew Louden | last post by:
I want to read how many records in the table, and insert a record with id field which increment the counter by 1. However, I had the following runtime on Dim s As Integer = CInt(dr("t")). Since "t"...
1
by: dazzalondon | last post by:
Hi there. I have various pages in an ASP.NET applicaiton and in the Page_load event I have data being read from a SQL DB filling textboxes on the page Now, sometimes the fields in the DB will...
5
by: Kivanç Karaca | last post by:
Hi all ! I am pretty sure this is an easy one but I couldnt find a way to fix it. How can I get rid of the asp.net error saying "Invalid attempt to read when no data is present. " when there is...
2
by: Cameron Frasnelly | last post by:
I emulated the code from the .Net Framework help (Titled "Using Stored Procedures with a Command") and I still receive and error... Error Received = "Invalid attempt to read when no data is...
4
by: MarkusR | last post by:
If I run the stored proc in the Query Analyzer this works and I get the expected result set back. However when I run it in my application I get a results set of one row but when I try to access the...
3
by: dcwbxb | last post by:
Trying to create a program which reads and echos the contents of an input data file, which consists of two records. When I complile my code I keep getting a "error C2001: newline in constant" error....
1
Oodles Of Noodles
by: Oodles Of Noodles | last post by:
Hello fellow geeks I have a problem in my database iVB .Net program that is generating 'Error:Invalid attempt to read when no data is present.' The weird part is that when you call the page from...
2
by: vijayrvs | last post by:
SearchCrawler.java The program search crawler used to search the files from the website. From the following program i got 7 compiler error. can any body clarify it and provide me solution. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...

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.