A
AlexB
The .ExecScalar method of the OracleClient seems to have a
bug. If I call it with a query that returns a number it
executes fine. However, it I attempt to return a string
if returns "0" and generates an unusual error message:
invalid cast from string to integer (see code below).
Is this a bug or is there a trick to making this work?
Anyone?
The following function works fine with "Select Count(*)
From table"; fails with "Select TextField From Table"
Function ExecScaler(psSQL as String, psConnect as String)
as Object
Dim oCmd As New OracleCommand()
Dim oConn As New OracleConnection()
oConn.ConnectionString = psConnect
With oCmd
.Connection = oConn
oConn.Open()
.CommandText = psSQL
ExecScalar = .ExecuteScalar()
End With
End Function
bug. If I call it with a query that returns a number it
executes fine. However, it I attempt to return a string
if returns "0" and generates an unusual error message:
invalid cast from string to integer (see code below).
Is this a bug or is there a trick to making this work?
Anyone?
The following function works fine with "Select Count(*)
From table"; fails with "Select TextField From Table"
Function ExecScaler(psSQL as String, psConnect as String)
as Object
Dim oCmd As New OracleCommand()
Dim oConn As New OracleConnection()
oConn.ConnectionString = psConnect
With oCmd
.Connection = oConn
oConn.Open()
.CommandText = psSQL
ExecScalar = .ExecuteScalar()
End With
End Function