Good Day Folks, It amazes me out the simplest things can cause major headaches in migrating from ASP to ASP.NET. I'm doing a SQL statement with count(*) but cannot display the result. The same SQL statement in ASP works fine. Any ideas ? Thanks in advance.
------------------------ Code Done ! ---------------------------- Error Exception Details: System.InvalidOperationException: Operation is not valid due to the current state of the object. Source Error: Line 31: dim dataset as OracleDataReader= myCommand.ExecuteReader()
Line 32: Line 33: Response.write(dataSet("stcount")) ' Line with error Line 34: Line 35: 'Response.write(theSQL) Source File: c:\inetpub\wwwroot\odpcountoracle.aspx Line: 33 Stack Trace: [InvalidOperationException: Operation is not valid due to the current
state of the object.] Oracle.DataAccess.Client.OracleDataReader.IsDBNull(Int32 i) +580 Oracle.DataAccess.Client.OracleDataReader.GetValue(Int32 i) +123 Oracle.DataAccess.Client.OracleDataReader.get_Item(Int32 i) +5 Oracle.DataAccess.Client.OracleDataReader.get_Item(String
columnName) +20 ASP.odpCountOracle_aspx.__Render__control1(HtmlTextWriter __output, Control parameterContainer) in c:\inetpub\wwwroot\odpcountoracle.aspx:33 System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +27 System.Web.UI.Control.Render(HtmlTextWriter
writer) +7 System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243 System.Web.UI.Page.ProcessRequestMain() +1929
You need to do a Read() to tell the datareader to retrieve a row of data before you can use it. However, it looks to me like you can just do an ExecuteScalar and not even bother with a DataReader.
c28560
Member
80 Points
17 Posts
Help ! ODP Error again
Oct 03, 2003 04:25 PM|LINK
Stephen Vaki...
Contributor
2540 Points
508 Posts
Re: Help ! ODP Error again
Oct 03, 2003 04:30 PM|LINK