Professional Web Applications Themes

error in asp : invalid attempt to read when no data is present - ASP.NET General

Below is the error I am receiving. I have checked SQL Profiler and it is receiving the correct query which runs fine in Query yzer. 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") ...

  1. #1

    Default 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 yzer. 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


    Brent Guest

  2. #2

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

    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" <com> wrote in message
    news:%phx.gbl... 
    -- 
    read 
    -- 
    ASP.NET 


    Marina Guest

  3. #3

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

    myDataReader.Read() ' before Line 137
    "Brent Burkart" <com> wrote in message
    news:%phx.gbl... 
    -- 
    read 
    -- 
    ASP.NET 


    MS Guest

Similar Threads

  1. Invalid Data ID Error
    By semi in forum Coldfusion Database Access
    Replies: 4
    Last Post: March 16th, 08:03 PM
  2. Invalid data error for CFSQLTYPE CF_SQL_VARBINARY
    By TrevJames in forum Coldfusion Database Access
    Replies: 0
    Last Post: July 22nd, 02:35 PM
  3. Replies: 4
    Last Post: January 12th, 08:59 PM
  4. Invalid attempt to Read when reader is closed.
    By Mike in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: September 28th, 05:56 PM
  5. Invalid attempt to read when no data is present.
    By Helixpoint in forum ASP.NET General
    Replies: 8
    Last Post: June 26th, 08:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139