Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

3
  • What ADO.NET provider are you using? ODP.NET? Commented Oct 31, 2011 at 0:54
  • 2
    the OracleCommand ExecuteScalar returns an object for the result. It's not strongly typed because the SQL statement is arbitrary, so the type isn't known until it's parsed (which is by the DB engine, not by the .NET runtime). The object returned can be null. You are assuming it is a string, and it may well be, and a lot of types can be implicitly converted to such, but it's a very dangerous assumption to make - that object can be of any type. As with any other object reference that you don't explicitly trust, first you should make sure it's not null. Commented Jun 22, 2015 at 16:10
  • A correct answer would be nice on this one. Commented Oct 16, 2015 at 20:52