Chrissirhc
Programmer
I'm running a query which is fine using OracleCommand.
Then create a OracleDataReader object.
Then I do a reader.Read();
The I try and print out the results to a textbox:
OracleResultsTextBox.Text = reader "EMA_AUTHENTICATION"].ToString();
And I get an exception:-
[InvalidOperationException: Invalid attempt to read when no data is present.]
System.Data.OracleClient.OracleDataReader.AssertReaderHasData() +43
System.Data.OracleClient.OracleDataReader.GetValue(Int32 i) +21
System.Data.OracleClient.OracleDataReader.get_Item(String name) +20
RADashboard.RADashboard.RetrieveColours() in c:\inetpub\ RADashboard.RADashboard.CheckSetConnectionOracle() in c:\inetpub\ RADashboard.RADashboard.Page_Load(Object sender, EventArgs e) in c:\inetpub\ System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +29
System.Web.UI.Page.ProcessRequestMain() +724
-------------------------------------------------
When I run OracleResultsTextBox.Text = reader.HasRows.ToString();
I get the result "false". I don't understand this because I know there is an entry in the table.
Can anyone help please?
Then create a OracleDataReader object.
Then I do a reader.Read();
The I try and print out the results to a textbox:
OracleResultsTextBox.Text = reader "EMA_AUTHENTICATION"].ToString();
And I get an exception:-
[InvalidOperationException: Invalid attempt to read when no data is present.]
System.Data.OracleClient.OracleDataReader.AssertReaderHasData() +43
System.Data.OracleClient.OracleDataReader.GetValue(Int32 i) +21
System.Data.OracleClient.OracleDataReader.get_Item(String name) +20
RADashboard.RADashboard.RetrieveColours() in c:\inetpub\ RADashboard.RADashboard.CheckSetConnectionOracle() in c:\inetpub\ RADashboard.RADashboard.Page_Load(Object sender, EventArgs e) in c:\inetpub\ System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +29
System.Web.UI.Page.ProcessRequestMain() +724
-------------------------------------------------
When I run OracleResultsTextBox.Text = reader.HasRows.ToString();
I get the result "false". I don't understand this because I know there is an entry in the table.
Can anyone help please?