473,320 Members | 1,799 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,320 software developers and data experts.

asp.net - "Invalid attempt to read when no data is present" though record exists

I want to populate combo box with data from OracleDataReader
, but "Invalid attempt to read when no data is present."

is thrown.

there are two rows returned , then too why such error.

plzzz share ur knowledge to help me out with this probs.

my code is as below,

Expand|Select|Wrap|Line Numbers
  1. Private Sub FillRoleDesc()
  2.         Dim strrefNo, sql As String
  3.         Dim dr1 As OracleDataReader
  4.         'Dim strGCRNno As String
  5.         Try
  6.             If Trim(txtRefNo.Text) <> "" Then
  7.                 strrefNo = Trim(txtRefNo.Text)
  8.                 dr = funRefernece(strrefNo)
  9.                 Do While dr.Read
  10.                     '  dr.GetString(0)
  11.  
  12.                     strGCRNno = dr.Item("CD_REF_NO")
  13.  
  14.                 Loop
  15.             End If
  16.             dr1 = funAccList(strGCRNno)
  17.             If dr1.HasRows Then  'here is get error "Invalid attempt to read when no data is present."
  18.  
  19.  
  20.  
  21.                 ddlOtherRel.DataSource = dr1
  22.                 ddlOtherRel.DataTextField = dr1(0)
  23.                 ddlOtherRel.DataValueField = dr1(0)
  24.                 ddlOtherRel.DataBind()
  25.                 'ddlOtherRel.Items.Insert(0, New ListItem("Select", "0"))
  26.             End If
  27.         Catch ex As Exception
  28.             lblError.Text = ex.Message
  29.         End Try
  30.     End Sub
Feb 1 '07 #1
3 6498
If any of you hv solution to my problem ,plzz plzzzz reply me soon
Feb 1 '07 #2
hello,This is purnima.I have also came across this exception and i have found that you must have register your UserName in database.bye for now.
May 22 '07 #3
mktita
5
solution for datareader :


when read data from datareader

check here like this me doing in c#;
Expand|Select|Wrap|Line Numbers
  1. dr.read();
  2. if(dr.hasrows == true) // i,e data is exist & check that ur writing correct columnname, like this dr["firstname"].tostring();, other wise u find error
  3.  
thanks mahendra, email : <email removed as per Signature Guidelines>
Oct 13 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Coral Snake | last post by:
I am having problems with programming even simple "Hello World" programs from books and tutorials that use Python GUI libraries. Such Programs cause python to throw "Attribute Errors" even when the...
1
by: Andrew McNab | last post by:
Hi folks, I have a problem with an MS Access SQL query which is being used in an Access Report, and am wondering if anyone can help. Basically, my query (shown below) gets some records from a...
3
by: Vic | last post by:
Dear All, I have a database of laboratory records in Access 2000. There is one form which acts as an interface to input experimetal data. This form incorporates information from several tables....
1
by: John Hunter | last post by:
I've recently had a nasty problem with the "Invalid reference to the property Form" error in subforms - nasty because it doesn't seem to consistently happen to all forms which contain the same...
3
by: Arnold | last post by:
I am having problem loading the image from the database. It gives this error: "Invalid parameter used." This is my source code: Private abyt() As Byte Private fo As New OpenFileDialog Private sf...
3
by: Martin | last post by:
Hi, I have an aspx page with two dropdownlist controls. I update the options in the second ddl based on selection made in the first. I do this with the ICallbackEventHandler interface, as per...
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: Darin | last post by:
I have a problem I just can't figure out. I have a form with a subform, and the recordsource of the subform has criteria based on some unbound fields in the parent form so that data in the parent...
10
by: jonathanemil | last post by:
Hello, I am a 1st semester Computer Science student in a Python class. Our current assignment calls for us to read a list from a file, create a 2-dimensional list from the file, and check to see...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
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...
1
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
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...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
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....

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.